diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2024-05-09 23:32:51 +0300 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2025-07-03 05:36:27 +0300 |
| commit | 9fd45235fdd2c2615a03c86ebe5a88b050dc5680 (patch) | |
| tree | 0d4e783064cca8a790fb8b868a5fa39a779adebb /include/linux | |
| parent | 2a8061ee5e41034eb14170ec4517b5583dbeff9f (diff) | |
| download | linux-9fd45235fdd2c2615a03c86ebe5a88b050dc5680.tar.xz | |
add locked_recursive_removal()
simple_recursive_removal() assumes that parent is not locked and
locks it when it finally gets to removing the victim itself.
Usually that's what we want, but there are places where the
parent is *already* locked and we need it to stay that way.
In those cases simple_recursive_removal() would, of course,
deadlock, so we have to play racy games with unlocking/relocking
the parent around the call or open-code the entire thing.
A better solution is to provide a variant that expects to
be called with the parent already locked by the caller.
Parent should be locked with I_MUTEX_PARENT, to avoid false
positives from lockdep.
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/fs.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 96c7925a6551..4f0c6bf8d652 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -3595,6 +3595,8 @@ extern int simple_rename(struct mnt_idmap *, struct inode *, unsigned int); extern void simple_recursive_removal(struct dentry *, void (*callback)(struct dentry *)); +extern void locked_recursive_removal(struct dentry *, + void (*callback)(struct dentry *)); extern int noop_fsync(struct file *, loff_t, loff_t, int); extern ssize_t noop_direct_IO(struct kiocb *iocb, struct iov_iter *iter); extern int simple_empty(struct dentry *); |
