linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neil@brown.name>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH 0/5 RFC] VFS: introduce new APIs to be used for directory locking
Date: Mon,  9 Jun 2025 15:01:12 +1000	[thread overview]
Message-ID: <20250609051419.106580-1-neil@brown.name> (raw)

The following 5 patches, which may depend on some of the earlier patches
I have sent, introduce new interfaces for requesting name-based
operations on directories (create, remove, rename).  They generally
combine the lookup and the lock operations and return a dentry which is
"locked".

Currently a dentry is always locked by locking the parent directory.
Once all clients are converted to use these interfaces we will be free to
change the details of the locking.  My proposal is to lock just the
relevant dentrys in a manner somewhat similar to the way that
d_in_lookup() dentrys are currently locked.

After the intended operation is completed (or aborted) the dentry is
unlocked with dentry_unlock().  This currently unlocks the parent
directory and dputs the dentry.  It is because the unlock is given just
the dentry, that one of my earlier patches changed vfs_mkdir() to drop
the lock when it consumes the dentry without replacing it (i.e.  in case
of error).  In that case there is nothing to pass to dentry_unlock().

I have a follow-on set of patches which change various parts of the
kernel to use these APIs instead of directly locking the parent.
They cover smb/server, nfsd, cachefiles, debugfs, binderfs, binfmt_misc,
kernel/bpf, devpts, fuse, infiniband.../qib_fs, ipc/mqueue, fs/proc,
s390/hypfs, security, sunrpc/rpc_pipe, xfs, tracefs.  overlayfs needs
some rearrangement of locking before it can be converted - that is on my
short-list of tasks.  I don't plan on a full submission of these APIs
until that is completed, in case I find a need for changes.


Thanks,
NeilBrown


 [PATCH 1/5] VFS: introduce lookup_and_lock() and friends
 [PATCH 2/5] VFS/btrfs: add lookup_and_lock_killable()
 [PATCH 3/5] VFS: change old_dir and new_dir in struct renamedata to
 [PATCH 4/5] VFS: add lookup_and_lock_rename()
 [PATCH 5/5] VFS: introduce lock_and_check_dentry()

             reply	other threads:[~2025-06-09  5:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-09  5:01 NeilBrown [this message]
2025-06-09  5:01 ` [PATCH 1/5] VFS: introduce lookup_and_lock() and friends NeilBrown
2025-06-09  5:01 ` [PATCH 2/5] VFS/btrfs: add lookup_and_lock_killable() NeilBrown
2025-06-09  5:01 ` [PATCH 3/5] VFS: change old_dir and new_dir in struct renamedata to dentrys NeilBrown
2025-06-09  5:01 ` [PATCH 4/5] VFS: add lookup_and_lock_rename() NeilBrown
2025-06-09  5:01 ` [PATCH 5/5] VFS: introduce lock_and_check_dentry() NeilBrown

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=20250609051419.106580-1-neil@brown.name \
    --to=neil@brown.name \
    --cc=brauner@kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.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;
as well as URLs for NNTP newsgroup(s).