Skip to content

Commit 10396f4

Browse files
jtlaytonchucklever
authored andcommitted
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: 44df6f4 ("NFSD: add delegation reaper to react to low memory condition") Reported-by: Vladimir Benes <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent 05258a0 commit 10396f4

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

fs/nfsd/nfs4state.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3042,12 +3042,9 @@ static void
30423042
nfsd4_cb_recall_any_release(struct nfsd4_callback *cb)
30433043
{
30443044
struct nfs4_client *clp = cb->cb_clp;
3045-
struct nfsd_net *nn = net_generic(clp->net, nfsd_net_id);
30463045

3047-
spin_lock(&nn->client_lock);
30483046
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);
30513048
}
30523049

30533050
static int
@@ -6616,7 +6613,7 @@ deleg_reaper(struct nfsd_net *nn)
66166613
list_add(&clp->cl_ra_cblist, &cblist);
66176614

66186615
/* release in nfsd4_cb_recall_any_release */
6619-
atomic_inc(&clp->cl_rpc_users);
6616+
kref_get(&clp->cl_nfsdfs.cl_ref);
66206617
set_bit(NFSD4_CLIENT_CB_RECALL_ANY, &clp->cl_flags);
66216618
clp->cl_ra_time = ktime_get_boottime_seconds();
66226619
}

0 commit comments

Comments
 (0)