From: NeilBrown <neilb@ownmail.net>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>
Cc: Jan Kara <jack@suse.cz>,
linux-fsdevel@vger.kernel.org, Jeff Layton <jlayton@kernel.org>,
Amir Goldstein <amir73il@gmail.com>,
Miklos Szeredi <miklos@szeredi.hu>,
linux-kernel@vger.kernel.org
Subject: [PATCH v4 0/7] VFS: prepare for changes to directory locking
Date: Sat, 5 Sep 2026 07:48:09 +1000 [thread overview]
Message-ID: <20260904215142.1060510-1-neilb@ownmail.net> (raw)
The only change in this v4 over v3 are to replace lock_sync with an
acquire/release pair which builds correctly when lockdep isn't enabled,
to add the 7th patch which I previously mentioned, and to include
linux-kernel so that sashiko gets to see the series.
Previous intro:
Hi,
As you know I am working on changes to locking for directory operations
such as lookup/create/remove/rename. The ultimate goal is for the VFS
to lock the dentry, not the parent directory, and to push the i_rwsem
parent locking down into the filesystems where it can be kept, removed,
or adjusted as best fits each filesystem.
The next step is to change the order of locking for d_alloc_parallel() -
which allocates a locked (in-lookup) dentry or waits for an existing
dentry to be unlocked. Currently d_alloc_parallel() is ordered below
i_rwsem on parent, so you cannot wait on i_rwsem while holding a locked
(in-lookup) dentry.
To push i_rwsem into filesystems I need to push i_rwsem below d_alloc_parallel(),
so code can wait for i_rwsem while holding an in-lookup dentry, but won't be
able to wait in d_alloc_parallel() while holding i_rwsem.
There are two broad changes that are needed before that order can be
swapped. This series sets the direction. Subsequent patches which I
hope can also land this cycle spread those changes throughout
filesystems.
The two changes are:
1 - don't call d_alloc_parallel() while holding i_rwsem.
This involves introducing d_alloc_trylock() and changing
some places to drop i_rwsem before taking d_alloc_parallel()
for this to work they will need to know if the lock is shared
or exclusive so LOOKUP_SHARED is added.
2 - don't d_drop() a dentry while it being worked on. This might
not be entirely needed yet, but it will be needed soon and doing it
now is a convenient time, and it helps make the end result clearer.
Calling d_drop() effectively unlocks an in-lookup denty.
It is OK for a filesystem to do this *after* an operation has
completed, whether in success or failure. Doing it before completion
will allow another dentry to be allocated maybe too early.
Enhancing d_splice_alias() to handle hashed dentries is key to
removing the need to d_drop() in filesystems. Though not strictly
necessary, this allows d_add() to be removed as there will be nothing
that d_add() does which cannot be done with d_splice_alias()
This set of 6 patches makes core-VFS changes. After this I have
- 7 nfs patches
- 6 afs patches
- 4 smb/client patches
- 3 cephfs patches
- 2 fuse patches
- one each for shmem, code, configfs, hostfs, procfs, ovl
and a patch to d_add_ci() which affects xfs and ntfs.
Once all of those have landed I have 4 patches to remove deprecated interfaces.
All of these can be found at
https://github.com/neilbrown/linux/commits/pdirops
If all goes to plan, then in the next cycle a few patches will invert the
lock order and remove LOOKUP_SHARED. Then we can get on to the really
fun stuff! (branch pdirops-next)
Thanks,
NeilBrown
[PATCH v4 1/7] VFS: fix various typos in documentation for
[PATCH v4 2/7] VFS: enhance d_splice_alias() to handle hashed
[PATCH v4 3/7] VFS: introduce d_alloc_trylock()
[PATCH v4 4/7] VFS: add d_duplicate()
[PATCH v4 5/7] VFS: Add LOOKUP_SHARED flag.
[PATCH v4 6/7] VFS: add lockdep monitoring of DCACHE_PAR_LOOKUP lock.
[PATCH v4 7/7] VFS: reserve a d_flags bit for fs-specific usage
next reply other threads:[~2026-09-04 21:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 21:48 NeilBrown [this message]
2026-09-04 21:48 ` [PATCH v4 1/7] VFS: fix various typos in documentation for start_creating start_removing etc NeilBrown
2026-09-04 21:48 ` [PATCH v4 2/7] VFS: enhance d_splice_alias() to handle hashed dentries NeilBrown
2026-09-04 21:48 ` [PATCH v4 3/7] VFS: introduce d_alloc_trylock() NeilBrown
2026-09-04 21:48 ` [PATCH v4 4/7] VFS: add d_duplicate() NeilBrown
2026-09-04 21:48 ` [PATCH v4 5/7] VFS: Add LOOKUP_SHARED flag NeilBrown
2026-09-04 21:48 ` [PATCH v4 6/7] VFS: add lockdep monitoring of DCACHE_PAR_LOOKUP lock NeilBrown
2026-09-30 16:31 ` Borah, Chaitanya Kumar
2026-09-30 21:08 ` NeilBrown
2026-10-01 10:39 ` Borah, Chaitanya Kumar
2026-09-04 21:48 ` [PATCH v4 7/7] VFS: reserve a d_flags bit for fs-specific usage NeilBrown
2026-09-15 21:11 ` [PATCH v4 0/7] VFS: prepare for changes to directory locking NeilBrown
2026-09-25 14:28 ` Christian Brauner
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=20260904215142.1060510-1-neilb@ownmail.net \
--to=neilb@ownmail.net \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=neil@brown.name \
--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®