]> git.ipfire.org Git - thirdparty/linux.git/commit
VFS/knfsd: Teach dentry_create() to use atomic_open()
authorBenjamin Coddington <bcodding@hammerspace.com>
Thu, 27 Nov 2025 16:02:05 +0000 (11:02 -0500)
committerChristian Brauner <brauner@kernel.org>
Mon, 15 Dec 2025 13:12:45 +0000 (14:12 +0100)
commit64a989dbd144e0622371396461b11335459692d2
treedb8583a5c781c323b0e81a2698416774d067b4fc
parent36411554e8895feb4197a3ddd19259c84cbf0511
VFS/knfsd: Teach dentry_create() to use atomic_open()

While knfsd offers combined exclusive create and open results to clients,
on some filesystems those results may not be atomic.  This behavior can be
observed.  For example, an open O_CREAT with mode 0 will succeed in creating
the file but unexpectedly return -EACCES from vfs_open().

Additionally reducing the number of remote RPC calls required for O_CREAT
on network filesystem provides a performance benefit in the open path.

Teach knfsd's helper dentry_create() to use atomic_open() for filesystems
that support it.  The previously const @path is passed up to atomic_open()
and may be modified depending on whether an existing entry was found or if
the atomic_open() returned an error and consumed the passed-in dentry.

Signed-off-by: Benjamin Coddington <bcodding@hammerspace.com>
Link: https://patch.msgid.link/8e449bfb64ab055abb9fd82641a171531415a88c.1764259052.git.bcodding@hammerspace.com
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/namei.c
fs/nfsd/nfs4proc.c
include/linux/fs.h