]> www.infradead.org Git - users/hch/misc.git/commitdiff
has_locked_children(): use guards
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 21 Aug 2025 01:48:35 +0000 (21:48 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 2 Sep 2025 23:35:57 +0000 (19:35 -0400)
... and document the locking requirements of __has_locked_children()

Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namespace.c

index 59948cbf9c47f7e7436b27e953b2ec9987af35df..2cb3cb8307ca047271acc044762354efdaa7163e 100644 (file)
@@ -2373,6 +2373,7 @@ void dissolve_on_fput(struct vfsmount *mnt)
        }
 }
 
+/* locks: namespace_shared && pinned(mnt) || mount_locked_reader */
 static bool __has_locked_children(struct mount *mnt, struct dentry *dentry)
 {
        struct mount *child;
@@ -2389,12 +2390,8 @@ static bool __has_locked_children(struct mount *mnt, struct dentry *dentry)
 
 bool has_locked_children(struct mount *mnt, struct dentry *dentry)
 {
-       bool res;
-
-       read_seqlock_excl(&mount_lock);
-       res = __has_locked_children(mnt, dentry);
-       read_sequnlock_excl(&mount_lock);
-       return res;
+       guard(mount_locked_reader)();
+       return __has_locked_children(mnt, dentry);
 }
 
 /*