Linux NFS development
 help / color / mirror / Atom feed
From: bfields@fieldses.org (J. Bruce Fields)
To: Jeff Layton <jlayton@kernel.org>
Cc: chuck.lever@oracle.com, neilb@suse.de, linux-nfs@vger.kernel.org
Subject: Re: [RFC PATCH 0/3] nfsd: close potential race between open and setting delegation
Date: Mon, 18 Jul 2022 17:18:19 -0400	[thread overview]
Message-ID: <20220718211819.GA28925@fieldses.org> (raw)
In-Reply-To: <20220714152819.128276-1-jlayton@kernel.org>

On Thu, Jul 14, 2022 at 11:28:16AM -0400, Jeff Layton wrote:
> Here's a first stab at a patchset to close a potential race when setting
> a delegation on a file. Between the point where we open the file and
> where we set the delegation, another task or client could unlink or
> rename the dentry. If that occurs, we shouldn't hand out a delegation
> in the open response, but we don't prevent that today.
> 
> The basic idea here is to re-do the lookup after setting the delegation.
> If the resulting dentry is not the one we have in the open, then we can
> reject handing out a delegation.

I have this distinct memory of actually doing that before.

But looking through the git history all I find is 4335723e8e9f "nfsd4:
fix delegation-unlink/rename race", from 2014, which claims to fix a
similar-sounding race in a different way.

How are you reproducing this?

--b.

> 
> Only lightly tested, so this is an RFC for now.
> 
> Jeff Layton (3): nfsd: drop fh argument from alloc_init_deleg nfsd:
> rework arguments to nfs4_set_delegation nfsd: vet the opened dentry
> after setting a delegation
> 
>  fs/nfsd/nfs4state.c | 65
>  ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 55
>  insertions(+), 10 deletions(-)
> 
> -- 2.36.1

  parent reply	other threads:[~2022-07-18 21:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14 15:28 [RFC PATCH 0/3] nfsd: close potential race between open and setting delegation Jeff Layton
2022-07-14 15:28 ` [RFC PATCH 1/3] nfsd: drop fh argument from alloc_init_deleg Jeff Layton
2022-07-14 15:28 ` [RFC PATCH 2/3] nfsd: rework arguments to nfs4_set_delegation Jeff Layton
2022-07-14 16:47   ` Chuck Lever III
2022-07-14 17:12     ` Jeff Layton
2022-07-14 17:14       ` Chuck Lever III
2022-07-14 18:59         ` Jeff Layton
2022-07-14 15:28 ` [RFC PATCH 3/3] nfsd: vet the opened dentry after setting a delegation Jeff Layton
2022-07-14 16:53   ` Chuck Lever III
2022-07-14 17:11     ` Jeff Layton
2022-07-14 17:16       ` Chuck Lever III
2022-07-14 18:49         ` Jeff Layton
2022-07-18 21:18 ` J. Bruce Fields [this message]
2022-07-18 21:43   ` [RFC PATCH 0/3] nfsd: close potential race between open and setting delegation Jeff Layton

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=20220718211819.GA28925@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=jlayton@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    /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