mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Benjamin Coddington <bcodding@hammerspace.com>
To: NeilBrown <neil@brown.name>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	Chuck Lever <chuck.lever@oracle.com>,
	Jeff Layton <jlayton@kernel.org>,
	Olga Kornievskaia <okorniev@redhat.com>,
	Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-nfs@vger.kernel.org, Trond Myklebust <trondmy@kernel.org>,
	Mike Snitzer <snitzer@kernel.org>
Subject: Re: [PATCH v1 0/3] Allow knfsd to use atomic_open()
Date: Thu, 27 Nov 2025 08:18:52 -0500	[thread overview]
Message-ID: <1B5CEF7A-9F38-49AC-93A3-7A81C3330684@hammerspace.com> (raw)
In-Reply-To: <176420378092.634289.15227073044036379500@noble.neil.brown.name>

On 26 Nov 2025, at 19:36, NeilBrown wrote:
> It isn't so much that the change is incomplete.  Rather, the change
> introduces a regression.
>
> The old code was
>
> -	error = vfs_create(mnt_idmap(path->mnt),
> -			   d_inode(path->dentry->d_parent),
> -			   path->dentry, mode, true);
>
>
> Note the "true" at the end.  This instructs nfs_create() to pass O_EXCL
> to nfs_do_create() so an over-the-wire exclusive create is performed.
>
> The new code is
>
> +		dentry = atomic_open(path, dentry, file, flags, mode);
>
> Where "flags" is oflags from nfsd4_vfs_create() which is
>    O_CREAT| O_LARGEFILE | O_(read/write/rdwr)
> and no O_EXCL.
> (When atomic_open is called by lookup_open, "open_flag" is passed which
> might contain O_EXCL).

Of course, you're quite right, I should put more effort into trying to
understand your very first reply.

Fixing this up seems simple enough, I think we just need to do this on top
of what's here:

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 7e39234e0649..6990ba92bca1 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -202,6 +202,9 @@ nfsd4_vfs_create(struct svc_fh *fhp, struct dentry **child,
        int oflags;

        oflags = O_CREAT | O_LARGEFILE;
+       if (nfsd4_create_is_exclusive(open->op_createmode))
+               oflags |= O_EXCL;
+
        switch (open->op_share_access & NFS4_SHARE_ACCESS_BOTH) {
        case NFS4_SHARE_ACCESS_WRITE:
                oflags |= O_WRONLY;

I will send this through my re-export testing, but I don't think that its
going to produce different results because we lack a multi-client test to
detect cases for O_EXCL.

Ben

  reply	other threads:[~2025-11-27 13:19 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-18 16:33 Benjamin Coddington
2025-11-18 16:33 ` [PATCH v1 1/3] VFS: move dentry_create() from fs/open.c to fs/namei.c Benjamin Coddington
2025-11-18 16:33 ` [PATCH v1 2/3] VFS: Prepare atomic_open() for dentry_create() Benjamin Coddington
2025-11-18 16:33 ` [PATCH v1 3/3] VFS/knfsd: Teach dentry_create() to use atomic_open() Benjamin Coddington
2025-11-18 18:01   ` Mike Snitzer
2025-11-18 18:39     ` Benjamin Coddington
2025-11-18 16:58 ` [PATCH v1 0/3] Allow knfsd " Chuck Lever
2025-11-18 17:17   ` Benjamin Coddington
2025-11-18 17:45   ` Trond Myklebust
2025-11-18 21:31 ` Jeff Layton
2025-11-19  1:23 ` NeilBrown
2025-11-19 12:46   ` Benjamin Coddington
2025-11-20 22:26     ` NeilBrown
2025-11-21  1:07       ` Benjamin Coddington
2025-11-26 20:59         ` NeilBrown
2025-11-26 22:06           ` Benjamin Coddington
2025-11-27  0:36             ` NeilBrown
2025-11-27 13:18               ` Benjamin Coddington [this message]
2025-11-19  1:32 ` [PATCH v1 2/3] VFS: Prepare atomic_open() for dentry_create() NeilBrown
2025-11-19 13:11   ` Benjamin Coddington
2025-11-19  1:41 ` [PATCH v1 3/3] VFS/knfsd: Teach dentry_create() to use atomic_open() NeilBrown
2025-11-19 13:02   ` Benjamin Coddington

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=1B5CEF7A-9F38-49AC-93A3-7A81C3330684@hammerspace.com \
    --to=bcodding@hammerspace.com \
    --cc=Dai.Ngo@oracle.com \
    --cc=brauner@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=jack@suse.cz \
    --cc=jlayton@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=okorniev@redhat.com \
    --cc=snitzer@kernel.org \
    --cc=tom@talpey.com \
    --cc=trondmy@kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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

all inboxes | Powered by JetHome®