diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2017-11-03 08:00:15 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2017-11-27 16:45:10 -0500 |
commit | 9271d7e509c1bfc0b9a418caec29ec8d1ac38270 (patch) | |
tree | fa80328c8ca89fb78e5a35ad2328566ebb3f14f1 /fs/nfsd | |
parent | beeca19cf1249a917ed737729dc92337c7633bea (diff) |
nfsd: Ensure we check stateid validity in the seqid operation checks
After taking the stateid st_mutex, we want to know that the stateid
still represents valid state before performing any non-idempotent
actions.
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4state.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 6d5993caf9bc..da07c24e9372 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -5234,15 +5234,9 @@ static __be32 nfs4_seqid_op_checks(struct nfsd4_compound_state *cstate, stateid_ | |||
5234 | status = nfsd4_check_seqid(cstate, sop, seqid); | 5234 | status = nfsd4_check_seqid(cstate, sop, seqid); |
5235 | if (status) | 5235 | if (status) |
5236 | return status; | 5236 | return status; |
5237 | if (stp->st_stid.sc_type == NFS4_CLOSED_STID | 5237 | status = nfsd4_lock_ol_stateid(stp); |
5238 | || stp->st_stid.sc_type == NFS4_REVOKED_DELEG_STID) | 5238 | if (status != nfs_ok) |
5239 | /* | 5239 | return status; |
5240 | * "Closed" stateid's exist *only* to return | ||
5241 | * nfserr_replay_me from the previous step, and | ||
5242 | * revoked delegations are kept only for free_stateid. | ||
5243 | */ | ||
5244 | return nfserr_bad_stateid; | ||
5245 | mutex_lock(&stp->st_mutex); | ||
5246 | status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nfsd4_has_session(cstate)); | 5240 | status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nfsd4_has_session(cstate)); |
5247 | if (status == nfs_ok) | 5241 | if (status == nfs_ok) |
5248 | status = nfs4_check_fh(current_fh, &stp->st_stid); | 5242 | status = nfs4_check_fh(current_fh, &stp->st_stid); |