From: Trond Myklebust <trondmy@kernel.org>
To: Anna Schumaker <anna.schumaker@oracle.com>,
Michael Stoler <michael.stoler@vastdata.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 3/3] NFS: Initialise verifiers for visible dentries in _nfs4_open_and_get_state
Date: Wed, 19 Nov 2025 11:50:01 -0500 [thread overview]
Message-ID: <2191ab425f19bd96354054af342f9ecbbd3dedd3.camel@kernel.org> (raw)
In-Reply-To: <39bca1e3-340d-4908-95d7-030507fb7b7b@oracle.com>
On Wed, 2025-11-19 at 11:14 -0500, Anna Schumaker wrote:
> Hi Trond,
>
> On 11/19/25 8:58 AM, Trond Myklebust wrote:
> > From: Trond Myklebust <trond.myklebust@hammerspace.com>
> >
> > Ensure that the verifiers are initialised before calling
> > d_splice_alias() in _nfs4_open_and_get_state().
> >
> > Reported-by: Michael Stoler <michael.stoler@vastdata.com>
> > Fixes: cf5b4059ba71 ("NFSv4: Fix races between open and dentry
> > revalidation")
> > Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
> > ---
> > fs/nfs/nfs4proc.c | 27 ++++++++++++++-------------
> > 1 file changed, 14 insertions(+), 13 deletions(-)
> >
> > diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> > index 93c6ce04332b..54595983525d 100644
> > --- a/fs/nfs/nfs4proc.c
> > +++ b/fs/nfs/nfs4proc.c
> > @@ -3174,18 +3174,6 @@ static int _nfs4_open_and_get_state(struct
> > nfs4_opendata *opendata,
> > if (opendata->o_res.rflags &
> > NFS4_OPEN_RESULT_PRESERVE_UNLINKED)
> > set_bit(NFS_INO_PRESERVE_UNLINKED, &NFS_I(state-
> > >inode)->flags);
> >
> > - dentry = opendata->dentry;
> > - if (d_really_is_negative(dentry)) {
> > - struct dentry *alias;
> > - d_drop(dentry);
> > - alias = d_splice_alias(igrab(state->inode),
> > dentry);
> > - /* d_splice_alias() can't fail here - it's a non-
> > directory */
> > - if (alias) {
> > - dput(ctx->dentry);
> > - ctx->dentry = dentry = alias;
> > - }
> > - }
> > -
> > switch(opendata->o_arg.claim) {
> > default:
> > break;
> > @@ -3196,7 +3184,20 @@ static int _nfs4_open_and_get_state(struct
> > nfs4_opendata *opendata,
> > break;
> > if (opendata->o_res.delegation.type != 0)
> > dir_verifier =
> > nfs_save_change_attribute(dir);
> > - nfs_set_verifier(dentry, dir_verifier);
> > + }
> > + nfs_set_verifier(dentry, dir_verifier);
>
> Isn't 'dentry' uninitialized here? As far as I can tell, it gets set
> for the first time
> in the very next statement.
D'oh! I wonder why the compiler let that pass?
Anyhow, yes, the nfs_set_verifier() call needs to be moved one line
down.
>
> Thanks,
> Anna
>
> > +
> > + dentry = opendata->dentry;
> > + if (d_really_is_negative(dentry)) {
> > + struct dentry *alias;
> > + d_drop(dentry);
> > + alias = d_splice_alias(igrab(state->inode),
> > dentry);
> > + /* d_splice_alias() can't fail here - it's a non-
> > directory */
> > + if (alias) {
> > + dput(ctx->dentry);
> > + nfs_set_verifier(alias, dir_verifier);
> > + ctx->dentry = dentry = alias;
> > + }
> > }
> >
> > /* Parse layoutget results before we check for access */
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trondmy@kernel.org, trond.myklebust@hammerspace.com
next prev parent reply other threads:[~2025-11-19 16:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-19 10:52 Spurious -EEXIST from NFSv3 Michael Stoler
2025-11-19 13:48 ` Trond Myklebust
2025-11-19 13:58 ` [PATCH 0/3] Fix verifier initialisation races for dentries Trond Myklebust
2025-11-19 13:58 ` [PATCH 1/3] NFS: Initialise verifiers for visible dentries in readdir and lookup Trond Myklebust
2025-11-19 13:58 ` [PATCH 2/3] NFS: Initialise verifiers for visible dentries in nfs_atomic_open() Trond Myklebust
2025-11-19 13:58 ` [PATCH 3/3] NFS: Initialise verifiers for visible dentries in _nfs4_open_and_get_state Trond Myklebust
2025-11-19 16:14 ` Anna Schumaker
2025-11-19 16:50 ` Trond Myklebust [this message]
2025-11-20 10:47 ` kernel test robot
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=2191ab425f19bd96354054af342f9ecbbd3dedd3.camel@kernel.org \
--to=trondmy@kernel.org \
--cc=anna.schumaker@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=michael.stoler@vastdata.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.