Skip to content

Commit 910ac68

Browse files
Trond MyklebustTrond Myklebust
authored andcommitted
NFSv4.1: Return NFS4ERR_BADSESSION to callbacks during session resets
If the client is in the process of resetting the session when it receives a callback, then returning NFS4ERR_DELAY may cause a deadlock with the DESTROY_SESSION call. Basically, if the client returns NFS4ERR_DELAY in response to the CB_SEQUENCE call, then the server is entitled to believe that the client is busy because it is already processing that call. In that case, the server is perfectly entitled to respond with a NFS4ERR_BACK_CHAN_BUSY to any DESTROY_SESSION call. Fix this by having the client reply with a NFS4ERR_BADSESSION in response to the callback if it is resetting the session. Cc: [email protected] [2.6.38+] Signed-off-by: Trond Myklebust <[email protected]>
1 parent 55a6739 commit 910ac68

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/nfs/callback_proc.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,11 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args,
452452
if (test_bit(NFS4_SESSION_DRAINING, &clp->cl_session->session_state)) {
453453
spin_unlock(&tbl->slot_tbl_lock);
454454
status = htonl(NFS4ERR_DELAY);
455+
/* Return NFS4ERR_BADSESSION if we're draining the session
456+
* in order to reset it.
457+
*/
458+
if (test_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state))
459+
status = htonl(NFS4ERR_BADSESSION);
455460
goto out;
456461
}
457462

0 commit comments

Comments
 (0)