[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1B5CEF7A-9F38-49AC-93A3-7A81C3330684@hammerspace.com>
Date: Thu, 27 Nov 2025 08:18:52 -0500
From: Benjamin Coddington <bcodding@...merspace.com>
To: NeilBrown <neil@...wn.name>
Cc: Alexander Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>,
Chuck Lever <chuck.lever@...cle.com>, Jeff Layton <jlayton@...nel.org>,
Olga Kornievskaia <okorniev@...hat.com>, Dai Ngo <Dai.Ngo@...cle.com>,
Tom Talpey <tom@...pey.com>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-nfs@...r.kernel.org,
Trond Myklebust <trondmy@...nel.org>, Mike Snitzer <snitzer@...nel.org>
Subject: Re: [PATCH v1 0/3] Allow knfsd to use atomic_open()
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
Powered by blists - more mailing lists