NFSv4: nfs_set_open_stateid must not trigger state recovery for closed state
authorTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 7 Nov 2017 18:10:46 +0000 (13:10 -0500)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Fri, 17 Nov 2017 21:43:49 +0000 (16:43 -0500)
In nfs_set_open_stateid_locked, we must ignore stateids from closed state.

Reported-by: Andrew W Elble <aweits@rit.edu>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/nfs4proc.c

index 1090016a238fd962d0ce86fb66b98ae447f27013..2c9c225796106ac4eeb8e32f25bf1974fed60e96 100644 (file)
@@ -1541,7 +1541,8 @@ static void nfs_set_open_stateid_locked(struct nfs4_state *state,
                write_seqlock(&state->seqlock);
        }
 
-       if (!nfs4_stateid_match_other(stateid, &state->open_stateid)) {
+       if (test_bit(NFS_OPEN_STATE, &state->flags) &&
+           !nfs4_stateid_match_other(stateid, &state->open_stateid)) {
                nfs4_stateid_copy(freeme, &state->open_stateid);
                nfs_test_and_clear_all_open_stateid(state);
        }