diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2025-08-20 20:12:47 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2025-09-02 19:35:56 -0400 |
| commit | 902e9904672bedcb25c6740d5c1d09e17de807eb (patch) | |
| tree | afa4c812ea741d7aacdcac72a012f1010f9c363c | |
| parent | 547af12dcd43851a4894ffc3c60e381ab9f0f5e7 (diff) | |
__detach_mounts(): use guards
Clean fit for guards use; guards can't be weaker due to umount_tree() calls.
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| -rw-r--r-- | fs/namespace.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/fs/namespace.c b/fs/namespace.c index 767ab751ee2a..1ae1ab8815c9 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2032,10 +2032,11 @@ void __detach_mounts(struct dentry *dentry) struct pinned_mountpoint mp = {}; struct mount *mnt; - namespace_lock(); - lock_mount_hash(); + guard(namespace_excl)(); + guard(mount_writer)(); + if (!lookup_mountpoint(dentry, &mp)) - goto out_unlock; + return; event++; while (mp.node.next) { @@ -2047,9 +2048,6 @@ void __detach_mounts(struct dentry *dentry) else umount_tree(mnt, UMOUNT_CONNECTED); } unpin_mountpoint(&mp); -out_unlock: - unlock_mount_hash(); - namespace_unlock(); } /* |
