* [PATCH] NFSd: nfs4_preprocess_seqid_op should only set *stpp on success
@ 2014-06-06 18:56 Jeff Layton
2014-06-07 14:08 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Jeff Layton @ 2014-06-06 18:56 UTC (permalink / raw)
To: bfields; +Cc: linux-nfs
From: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Jeff Layton <jlayton@primarydata.com>
---
fs/nfsd/nfs4state.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index f429883fb4bb..f8c61c2a0a9e 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3897,6 +3897,7 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid,
{
__be32 status;
struct nfs4_stid *s;
+ struct nfs4_ol_stateid *stp = NULL;
dprintk("NFSD: %s: seqid=%d stateid = " STATEID_FMT "\n", __func__,
seqid, STATEID_VAL(stateid));
@@ -3906,11 +3907,14 @@ nfs4_preprocess_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid,
cstate->minorversion, nn);
if (status)
return status;
- *stpp = openlockstateid(s);
+ stp = openlockstateid(s);
if (!nfsd4_has_session(cstate))
- cstate->replay_owner = (*stpp)->st_stateowner;
+ cstate->replay_owner = stp->st_stateowner;
- return nfs4_seqid_op_checks(cstate, stateid, seqid, *stpp);
+ status = nfs4_seqid_op_checks(cstate, stateid, seqid, stp);
+ if (!status)
+ *stpp = stp;
+ return status;
}
static __be32 nfs4_preprocess_confirmed_seqid_op(struct nfsd4_compound_state *cstate, u32 seqid,
--
1.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] NFSd: nfs4_preprocess_seqid_op should only set *stpp on success
2014-06-06 18:56 [PATCH] NFSd: nfs4_preprocess_seqid_op should only set *stpp on success Jeff Layton
@ 2014-06-07 14:08 ` Christoph Hellwig
2014-06-07 14:23 ` Jeff Layton
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2014-06-07 14:08 UTC (permalink / raw)
To: Jeff Layton; +Cc: bfields, linux-nfs
On Fri, Jun 06, 2014 at 02:56:34PM -0400, Jeff Layton wrote:
> From: Trond Myklebust <trond.myklebust@primarydata.com>
>
> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
> Signed-off-by: Jeff Layton <jlayton@primarydata.com>
The new code looks correct, but shouldn't callers already take care
not to use the returned stateid only if nfs4_preprocess_seqid_op returns
0?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] NFSd: nfs4_preprocess_seqid_op should only set *stpp on success
2014-06-07 14:08 ` Christoph Hellwig
@ 2014-06-07 14:23 ` Jeff Layton
2014-06-07 14:26 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Jeff Layton @ 2014-06-07 14:23 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: bfields, linux-nfs
On Sat, 7 Jun 2014 07:08:00 -0700
Christoph Hellwig <hch@infradead.org> wrote:
> On Fri, Jun 06, 2014 at 02:56:34PM -0400, Jeff Layton wrote:
> > From: Trond Myklebust <trond.myklebust@primarydata.com>
> >
> > Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
> > Signed-off-by: Jeff Layton <jlayton@primarydata.com>
>
> The new code looks correct, but shouldn't callers already take care
> not to use the returned stateid only if nfs4_preprocess_seqid_op returns
> 0?
>
Yeah, I mentioned that to Bruce on IRC. This is not really a bugfix,
per-se, but more of a defensive coding measure.
--
Jeff Layton <jlayton@primarydata.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] NFSd: nfs4_preprocess_seqid_op should only set *stpp on success
2014-06-07 14:23 ` Jeff Layton
@ 2014-06-07 14:26 ` Christoph Hellwig
0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2014-06-07 14:26 UTC (permalink / raw)
To: Jeff Layton; +Cc: Christoph Hellwig, bfields, linux-nfs
On Sat, Jun 07, 2014 at 10:23:26AM -0400, Jeff Layton wrote:
> Yeah, I mentioned that to Bruce on IRC. This is not really a bugfix,
> per-se, but more of a defensive coding measure.
Looks fine to me for that,
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-06-07 14:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-06 18:56 [PATCH] NFSd: nfs4_preprocess_seqid_op should only set *stpp on success Jeff Layton
2014-06-07 14:08 ` Christoph Hellwig
2014-06-07 14:23 ` Jeff Layton
2014-06-07 14:26 ` Christoph Hellwig
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).