Skip to content

Commit 3b81660

Browse files
bcodding-rhchucklever
authored andcommitted
nfsd: Fix race to FREE_STATEID and cl_revoked
We have some reports of linux NFS clients that cannot satisfy a linux knfsd server that always sets SEQ4_STATUS_RECALLABLE_STATE_REVOKED even though those clients repeatedly walk all their known state using TEST_STATEID and receive NFS4_OK for all. Its possible for revoke_delegation() to set NFS4_REVOKED_DELEG_STID, then nfsd4_free_stateid() finds the delegation and returns NFS4_OK to FREE_STATEID. Afterward, revoke_delegation() moves the same delegation to cl_revoked. This would produce the observed client/server effect. Fix this by ensuring that the setting of sc_type to NFS4_REVOKED_DELEG_STID and move to cl_revoked happens within the same cl_lock. This will allow nfsd4_free_stateid() to properly remove the delegation from cl_revoked. Link: https://bugzilla.redhat.com/show_bug.cgi?id=2217103 Link: https://bugzilla.redhat.com/show_bug.cgi?id=2176575 Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Cc: stable@vger.kernel.org # v4.17+ Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 101df45 commit 3b81660

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/nfsd/nfs4state.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1354,9 +1354,9 @@ static void revoke_delegation(struct nfs4_delegation *dp)
13541354
trace_nfsd_stid_revoke(&dp->dl_stid);
13551355

13561356
if (clp->cl_minorversion) {
1357+
spin_lock(&clp->cl_lock);
13571358
dp->dl_stid.sc_type = NFS4_REVOKED_DELEG_STID;
13581359
refcount_inc(&dp->dl_stid.sc_count);
1359-
spin_lock(&clp->cl_lock);
13601360
list_add(&dp->dl_recall_lru, &clp->cl_revoked);
13611361
spin_unlock(&clp->cl_lock);
13621362
}

0 commit comments

Comments
 (0)