From: Trond Myklebust <trond.myklebust@primarydata.com>
To: bfields@fieldses.org
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH v2 6/7] nfsd: Ensure we check stateid validity in the seqid operation checks
Date: Fri, 3 Nov 2017 08:00:15 -0400 [thread overview]
Message-ID: <20171103120016.6200-7-trond.myklebust@primarydata.com> (raw)
In-Reply-To: <20171103120016.6200-6-trond.myklebust@primarydata.com>
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>
---
fs/nfsd/nfs4state.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index f13fba4f51ec..cbd6a10ddda2 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -5161,15 +5161,9 @@ static __be32 nfs4_seqid_op_checks(struct nfsd4_compound_state *cstate, stateid_
status = nfsd4_check_seqid(cstate, sop, seqid);
if (status)
return status;
- if (stp->st_stid.sc_type == NFS4_CLOSED_STID
- || stp->st_stid.sc_type == NFS4_REVOKED_DELEG_STID)
- /*
- * "Closed" stateid's exist *only* to return
- * nfserr_replay_me from the previous step, and
- * revoked delegations are kept only for free_stateid.
- */
- return nfserr_bad_stateid;
- mutex_lock(&stp->st_mutex);
+ status = nfsd4_lock_ol_stateid(stp);
+ if (status != nfs_ok)
+ return status;
status = check_stateid_generation(stateid, &stp->st_stid.sc_stateid, nfsd4_has_session(cstate));
if (status == nfs_ok)
status = nfs4_check_fh(current_fh, &stp->st_stid);
--
2.13.6
next prev parent reply other threads:[~2017-11-03 12:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-03 12:00 [PATCH v2 0/7] Tighten up locking around stateids in knfsd Trond Myklebust
2017-11-03 12:00 ` [PATCH v2 1/7] nfsd: Fix stateid races between OPEN and CLOSE Trond Myklebust
2017-11-03 12:00 ` [PATCH v2 2/7] nfsd: Fix another OPEN stateid race Trond Myklebust
2017-11-03 12:00 ` [PATCH v2 3/7] nfsd: CLOSE SHOULD return the invalid special stateid for NFSv4.x (x>0) Trond Myklebust
2017-11-03 12:00 ` [PATCH v2 4/7] nfsd: Ensure we don't recognise lock stateids after freeing them Trond Myklebust
2017-11-03 12:00 ` [PATCH v2 5/7] nfsd: Fix race in lock stateid creation Trond Myklebust
2017-11-03 12:00 ` Trond Myklebust [this message]
2017-11-03 12:00 ` [PATCH v2 7/7] nfsd: Fix races with check_stateid_generation() Trond Myklebust
2017-11-07 21:37 ` [PATCH v2 5/7] nfsd: Fix race in lock stateid creation J. Bruce Fields
2017-11-07 20:06 ` [PATCH v2 0/7] Tighten up locking around stateids in knfsd J. Bruce Fields
2017-11-07 20:47 ` J. Bruce Fields
2017-11-07 21:55 ` J. Bruce Fields
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171103120016.6200-7-trond.myklebust@primarydata.com \
--to=trond.myklebust@primarydata.com \
--cc=bfields@fieldses.org \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).