Linux NFS development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Trond Myklebust <trondmy@kernel.org>,
	Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] nfsd: Remove incorrect check in nfsd4_validate_stateid
Date: Tue, 18 Jul 2023 10:10:40 -0400	[thread overview]
Message-ID: <916ec4f1999cdb2ff358d7cbfc69f3bbe7f4f2fc.camel@kernel.org> (raw)
In-Reply-To: <106daf5e0242b67bdb04e2e8e4ae7e114a4b47ab.camel@kernel.org>

On Tue, 2023-07-18 at 09:51 -0400, Trond Myklebust wrote:
> On Tue, 2023-07-18 at 09:35 -0400, Jeff Layton wrote:
> > On Tue, 2023-07-18 at 08:38 -0400, trondmy@kernel.org wrote:
> > > From: Trond Myklebust <trond.myklebust@hammerspace.com>
> > > 
> > > If the client is calling TEST_STATEID, then it is because some
> > > event
> > > occurred that requires it to check all the stateids for validity
> > > and
> > > call FREE_STATEID on the ones that have been revoked. In this case,
> > > either the stateid exists in the list of stateids associated with
> > > that
> > > nfs4_client, in which case it should be tested, or it does not.
> > > There
> > > are no additional conditions to be considered.
> > > 
> > > Reported-by: Frank Ch. Eigler <fche@redhat.com>
> > > Fixes: 663e36f07666 ("nfsd4: kill warnings on testing stateids with
> > > mismatched clientids")
> > > Cc: stable@vger.kernel.org
> > > Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
> > > ---
> > >  fs/nfsd/nfs4state.c | 2 --
> > >  1 file changed, 2 deletions(-)
> > > 
> > > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> > > index 6e61fa3acaf1..3aefbad4cc09 100644
> > > --- a/fs/nfsd/nfs4state.c
> > > +++ b/fs/nfsd/nfs4state.c
> > > @@ -6341,8 +6341,6 @@ static __be32 nfsd4_validate_stateid(struct
> > > nfs4_client *cl, stateid_t *stateid)
> > >         if (ZERO_STATEID(stateid) || ONE_STATEID(stateid) ||
> > >                 CLOSE_STATEID(stateid))
> > >                 return status;
> > > -       if (!same_clid(&stateid->si_opaque.so_clid, &cl-
> > > > cl_clientid))
> > > -               return status;
> > >         spin_lock(&cl->cl_lock);
> > >         s = find_stateid_locked(cl, stateid);
> > >         if (!s)
> > 
> > IDGI. Is this fixing an actual bug? Granted this code does seem
> > unnecessary, but removing it doesn't seem like it will cause any
> > user-visible change in behavior. Am I missing something?
> 
> It was clearly triggering in
> https://bugzilla.redhat.com/show_bug.cgi?id=2176575
> 
> Furthermore, if you look at commit 663e36f07666, you'll see that all it
> does is remove the log message because "it is expected". For some
> unknown reason, it did not register that "then the check is incorrect".
> 

Yeah, that commit just removes the warning, AFAICT.

> So yes, this is fixing a real bug.
> 

My assumption was that for any stateid that the server hands out, the
si_opaque.so_clid must match the clid. But...it looks like s2s copy
might have changed that rule?

In any case, the patch looks fine, so I have no objection. I'm just
trying to understand how this could happen.

Reviewed-by: Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2023-07-18 14:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-18 12:38 [PATCH] nfsd: Remove incorrect check in nfsd4_validate_stateid trondmy
2023-07-18 13:35 ` Jeff Layton
2023-07-18 13:51   ` Trond Myklebust
2023-07-18 14:10     ` Jeff Layton [this message]
2023-07-18 14:12     ` Chuck Lever III
2023-07-18 14:30       ` Trond Myklebust
2023-07-18 18:15         ` Chuck Lever III

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=916ec4f1999cdb2ff358d7cbfc69f3bbe7f4f2fc.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trondmy@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