> On Dec 10, 2023, at 9:55 AM, ditang chen <ditang.c@xxxxxxxxx> wrote: > > Multiple nfs clients with the same hostname cause session exceptions, > the new client find confirmed nfs4_client by name in the > nfsd4_create_session > and then will release the se_hash list: > > old = find_confirmed_client_by_name(&unconf->cl_name, nn); > if (old) { > status = mark_client_expired_locked(old); > if (status) { > old = NULL; > goto out_free_conn; > } > trace_nfsd_clid_replaced(&old->cl_clientid); > } > move_to_confirmed(unconf); > > Is there any other option, such as IP instead of host name, which is > usually unique? Yes. The NFSv4 protocol needs each client to present a unique identifier to a server in order for the server to collect open and lock state belonging to that client. Typically the client's hostname is unique enough for this purpose. Sometimes, though, the client's hostname doesn't provide a globally unique identity. Client implementations usually provide a secondary way of identifying themselves. I can't give an exact recipe because each client implementation has its own peculiar administrative interface for this; and sometimes they have more than one, to deal with things like containers (Linux) or zones (Solaris). Look for something on your clients that enables you to set the nfs4_client_id to something unique. You can use a random string or "uuid -r" for this purpose. But each client instance needs to have its own distinct nfs4_client_id. Here's a general description of how this works on Linux NFS clients: https://www.kernel.org/doc/html/latest/filesystems/nfs/client-identifier.html HTH. > Dec 1 22:42:32 dd kernel: nfsd4_exchange_id rqstp=000000006668b520 > exid=00000000a44d3b72 clname.len=35 clname.data=000000007b1b5592 > ip_addr=192.168.122.130 flags 101, spa_how 0 > Dec 1 22:42:32 dd kernel: nfsd4_exchange_id seqid 0 flags 20001 > Dec 1 22:42:32 dd kernel: check_slot_seqid enter. seqid 1 slot_seqid 0 > Dec 1 22:42:32 dd kernel: alloc_cld_upcall: allocated xid 10 > Dec 1 22:42:32 dd rpc.mountd[25713]: v4.2 client attached: > 0xe21bb8c66569eeaf from "192.168.122.130:894" > Dec 1 22:42:32 dd rpc.mountd[25713]: v4.2 client detached: > 0xe21bb8c56569eeaf from "192.168.122.93:791" > Dec 1 22:42:32 dd kernel: __find_in_sessionid_hashtbl: > 1701441199:3793467590:5:0 > Dec 1 22:42:32 dd kernel: nfsd4_sequence: slotid 0 > Dec 1 22:42:32 dd kernel: check_slot_seqid enter. seqid 1 slot_seqid 0 > Dec 1 22:42:32 dd kernel: nfsd: fh_compose(exp 103:08/128 /, ino=128) > Dec 1 22:42:32 dd kernel: --> nfsd4_store_cache_entry slot 000000006ef6f422 > Dec 1 22:42:32 dd kernel: __find_in_sessionid_hashtbl: > 1701441199:3793467590:5:0 > Dec 1 22:42:32 dd kernel: nfsd4_sequence: slotid 0 > Dec 1 22:42:32 dd kernel: check_slot_seqid enter. seqid 2 slot_seqid 1 > Dec 1 22:42:32 dd kernel: alloc_cld_upcall: allocated xid 11 > Dec 1 22:42:32 dd kernel: --> nfsd4_store_cache_entry slot 000000006ef6f422 > Dec 1 22:42:36 dd kernel: __find_in_sessionid_hashtbl: > 1701441199:3793467589:4:0 > Dec 1 22:42:36 dd kernel: __find_in_sessionid_hashtbl: session not found > Dec 1 22:42:36 dd kernel: nfsd4_destroy_session: 1701441199:3793467589:4:0 > Dec 1 22:42:36 dd kernel: __find_in_sessionid_hashtbl: > 1701441199:3793467589:4:0 > Dec 1 22:42:36 dd kernel: __find_in_sessionid_hashtbl: session not found > Dec 1 22:42:36 dd kernel: nfsd4_exchange_id rqstp=000000006668b520 > exid=00000000a44d3b72 clname.len=35 clname.data=000000007b1b5592 > ip_addr=192.168.122.93 flags 101, spa_how 0 > Dec 1 22:42:36 dd kernel: nfsd4_exchange_id seqid 0 flags 20001 > Dec 1 22:42:36 dd kernel: check_slot_seqid enter. seqid 1 slot_seqid 0 > Dec 1 22:42:36 dd kernel: alloc_cld_upcall: allocated xid 12 > Dec 1 22:42:36 dd rpc.mountd[25713]: v4.2 client attached: > 0xe21bb8c76569eeaf from "192.168.122.93:791" > Dec 1 22:42:36 dd rpc.mountd[25713]: v4.2 client detached: > 0xe21bb8c66569eeaf from "192.168.122.130:894" > Dec 1 22:42:36 dd kernel: __find_in_sessionid_hashtbl: > 1701441199:3793467591:6:0 > Dec 1 22:42:36 dd kernel: nfsd4_sequence: slotid 0 > Dec 1 22:42:36 dd kernel: check_slot_seqid enter. seqid 1 slot_seqid 0 > Dec 1 22:42:36 dd kernel: nfsd: fh_compose(exp 103:08/128 /, ino=128) > Dec 1 22:42:36 dd kernel: --> nfsd4_store_cache_entry slot 00000000e1f66c24 > Dec 1 22:42:36 dd kernel: __find_in_sessionid_hashtbl: > 1701441199:3793467591:6:0 > Dec 1 22:42:36 dd kernel: nfsd4_sequence: slotid 0 > Dec 1 22:42:36 dd kernel: check_slot_seqid enter. seqid 2 slot_seqid 1 > Dec 1 22:42:36 dd kernel: alloc_cld_upcall: allocated xid 13 > Dec 1 22:42:36 dd kernel: --> nfsd4_store_cache_entry slot 00000000e1f66c24 > Dec 1 22:43:33 dd kernel: __find_in_sessionid_hashtbl: > 1701441199:3793467590:5:0 > Dec 1 22:43:33 dd kernel: __find_in_sessionid_hashtbl: session not found > Dec 1 22:43:33 dd kernel: nfsd4_destroy_session: 1701441199:3793467590:5:0 > Dec 1 22:43:33 dd kernel: __find_in_sessionid_hashtbl: > 1701441199:3793467590:5:0 > Dec 1 22:43:33 dd kernel: __find_in_sessionid_hashtbl: session not found -- Chuck Lever