nfsd: hold a lighter-weight client reference over CB_RECALL_ANY

Currently the CB_RECALL_ANY job takes a cl_rpc_users reference to the
client. While a callback job is technically an RPC that counter is
really more for client-driven RPCs, and this has the effect of
preventing the client from being unhashed until the callback completes.

If nfsd decides to send a CB_RECALL_ANY just as the client reboots, we
can end up in a situation where the callback can't complete on the (now
dead) callback channel, but the new client can't connect because the old
client can't be unhashed. This usually manifests as a NFS4ERR_DELAY
return on the CREATE_SESSION operation.

The job is only holding a reference to the client so it can clear a flag
after the RPC completes. Fix this by having CB_RECALL_ANY instead hold a
reference to the cl_nfsdfs.cl_ref. Typically we only take that sort of
reference when dealing with the nfsdfs info files, but it should work
appropriately here to ensure that the nfs4_client doesn't disappear.

Fixes: 44df6f439a17 ("NFSD: add delegation reaper to react to low memory condition")
Reported-by: Vladimir Benes <vbenes@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

authored by Jeff Layton and committed by Chuck Lever 10396f4d 05258a0a

Changed files
+2 -5
fs
+2 -5
fs/nfsd/nfs4state.c
··· 3042 3042 nfsd4_cb_recall_any_release(struct nfsd4_callback *cb) 3043 3043 { 3044 3044 struct nfs4_client *clp = cb->cb_clp; 3045 - struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id); 3046 3045 3047 - spin_lock(&nn->client_lock); 3048 3046 clear_bit(NFSD4_CLIENT_CB_RECALL_ANY, &clp->cl_flags); 3049 - put_client_renew_locked(clp); 3050 - spin_unlock(&nn->client_lock); 3047 + drop_client(clp); 3051 3048 } 3052 3049 3053 3050 static int ··· 6613 6616 list_add(&clp->cl_ra_cblist, &cblist); 6614 6617 6615 6618 /* release in nfsd4_cb_recall_any_release */ 6616 - atomic_inc(&clp->cl_rpc_users); 6619 + kref_get(&clp->cl_nfsdfs.cl_ref); 6617 6620 set_bit(NFSD4_CLIENT_CB_RECALL_ANY, &clp->cl_flags); 6618 6621 clp->cl_ra_time = ktime_get_boottime_seconds(); 6619 6622 }