Commit 4e54ab8d authored by Trond Myklebust's avatar Trond Myklebust

NFS: Ensure that we update the sequence id under the slot table lock

Fix a callback slot table regression.

Fixes: e937ee71 ("nfs: Only update callback sequnce id when CB_SEQUENCE success")
Cc: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 0579c8d2
...@@ -435,14 +435,13 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args, ...@@ -435,14 +435,13 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args,
spin_lock(&tbl->slot_tbl_lock); spin_lock(&tbl->slot_tbl_lock);
/* state manager is resetting the session */ /* state manager is resetting the session */
if (test_bit(NFS4_SLOT_TBL_DRAINING, &tbl->slot_tbl_state)) { if (test_bit(NFS4_SLOT_TBL_DRAINING, &tbl->slot_tbl_state)) {
spin_unlock(&tbl->slot_tbl_lock);
status = htonl(NFS4ERR_DELAY); status = htonl(NFS4ERR_DELAY);
/* Return NFS4ERR_BADSESSION if we're draining the session /* Return NFS4ERR_BADSESSION if we're draining the session
* in order to reset it. * in order to reset it.
*/ */
if (test_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state)) if (test_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state))
status = htonl(NFS4ERR_BADSESSION); status = htonl(NFS4ERR_BADSESSION);
goto out; goto out_unlock;
} }
memcpy(&res->csr_sessionid, &args->csa_sessionid, memcpy(&res->csr_sessionid, &args->csa_sessionid,
...@@ -453,9 +452,8 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args, ...@@ -453,9 +452,8 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args,
res->csr_target_highestslotid = NFS41_BC_MAX_CALLBACKS - 1; res->csr_target_highestslotid = NFS41_BC_MAX_CALLBACKS - 1;
status = validate_seqid(tbl, args); status = validate_seqid(tbl, args);
spin_unlock(&tbl->slot_tbl_lock);
if (status) if (status)
goto out; goto out_unlock;
cps->slotid = args->csa_slotid; cps->slotid = args->csa_slotid;
...@@ -466,7 +464,7 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args, ...@@ -466,7 +464,7 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args,
*/ */
if (referring_call_exists(clp, args->csa_nrclists, args->csa_rclists)) { if (referring_call_exists(clp, args->csa_nrclists, args->csa_rclists)) {
status = htonl(NFS4ERR_DELAY); status = htonl(NFS4ERR_DELAY);
goto out; goto out_unlock;
} }
/* /*
...@@ -475,6 +473,8 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args, ...@@ -475,6 +473,8 @@ __be32 nfs4_callback_sequence(struct cb_sequenceargs *args,
* (sequence ID, cached reply) MUST NOT change. * (sequence ID, cached reply) MUST NOT change.
*/ */
slot->seq_nr++; slot->seq_nr++;
out_unlock:
spin_unlock(&tbl->slot_tbl_lock);
out: out:
cps->clp = clp; /* put in nfs4_callback_compound */ cps->clp = clp; /* put in nfs4_callback_compound */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment