|
|
Log in / Subscribe / Register

VFS/nfsd: replace dentry_create()

From:  NeilBrown <neilb-AT-ownmail.net>
To:  Christian Brauner <brauner-AT-kernel.org>, Alexander Viro <viro-AT-zeniv.linux.org.uk>, Chuck Lever <cel-AT-kernel.org>, Jeff Layton <jlayton-AT-kernel.org>
Subject:  [PATCH/RFC 00/18] VFS/nfsd: replace dentry_create()
Date:  Mon, 01 Jun 2026 16:37:48 +1000
Message-ID:  <20260601070042.249432-1-neilb@ownmail.net>
Cc:  Jan Kara <jack-AT-suse.cz>, linux-fsdevel-AT-vger.kernel.org, linux-nfs-AT-vger.kernel.org, "Jori Koolstra" <jkoolstra-AT-xs4all.nl>, Benjamin Coddington <ben.coddington-AT-hammerspace.com>, "Mateusz Guzik" <mjguzik-AT-gmail.com>
Archive-link:  Article

My recent proposal for inverting the order between inode_lock() on a
parent dir and d_alloc_parallel()[1] missed that fact that atomic_open()
has two callers, and would have resulted in easy deadlocks from nfsd
when re-exporting and NFS filesystem.

I think the best way to fix this is to provide a richer interface for
nfsd to use, which includes all the locking as well as inode_operations
calls.  This allows the nfsd behaviour to share more code with the
system-call behaviour.

This series refactors code between lookup_open() and
open_last_lookups(), and uses the new lookup_open() to provide
vfs_lookup_open().  It then rearranges the code in nfsd so that it can
easily use vfs_lookup_open() instead of dentry_create().  Finally
dentry_create() is removed.

This series is based on a merge of nfsd-testing, vfs-next/work.dcache,
and vfs/vfs.fixes (though I can't see my "Fix possible failure to
unlock.."[2] patch in there yet).  So I probably will need to resubmit
after a bunch of that has hit mainline - though a few of the patches
could easily be cherry-picked now.

This will conflict with the O_CREAT|O_DIRECTORY work so obviously we'll need to
work out how to order them once we both have enough positive review.

All these patches are in github/neilbrown/linux in branch pdirops.
You can also preview the other stuff I need this for in pdirops-next.

Please review if you have time.

Thanks,
NeilBrown


[1] https://lore.kernel.org/all/20260312214330.3885211-1-neil...
[2] https://lore.kernel.org/all/177969022571.3379282.16448744...

 [PATCH 01/18] VFS: move mnt_want_write() and locking into
 [PATCH 02/18] VFS: move delegated_inode retry loop into lookup_open()
 [PATCH 03/18] VFS: replace nameidata and open_flag args to
 [PATCH 04/18] VFS: add vfs_lookup_open()
 [PATCH 05/18] VFS: dentry_create: always set FMODE_CREATE when file
 [PATCH 06/18] nfsd: replace fh_fill_both_attrs() with
 [PATCH 07/18] nfsd: move fh_want_write() after preamble in
 [PATCH 08/18] nfsd: move more nfs-specific code into preamble of
 [PATCH 09/18] nfsd: remove subtlety from nfsd4_create_file()
 [PATCH 10/18] nfsd: in nfsd4_create_file() let VFS report if file was
 [PATCH 11/18] nfsd: nfsd4_create_file(): remove NFSD_MAY_CREATE
 [PATCH 12/18] nfsd: reduce range of directory lock in
 [PATCH 13/18] nfsd: open-code nfsd4_vfs_create() into
 [PATCH 14/18] nfsd: move some code out of the d_really_is_negative()
 [PATCH 15/18] nfsd: reduce want-write range in nfsd4_create_file(
 [PATCH 16/18] nfsd: switch nfsd4_create_file() to use
 [PATCH 17/18] nfsd: use vfs_lookup_open() for non-creating open
 [PATCH 18/18] VFS: remove dentry_create()



Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds