diff --git a/fs/namespace.c b/fs/namespace.c
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -6821,6 +6821,7 @@ static bool mnt_already_visible(struct mnt_namespace *ns,
                return false;
 
        guard(namespace_shared)();
+       guard(mount_locked_reader)();
        hlist_for_each_entry(mnt, &ns->mnt_visible_mounts, mnt_ns_visible) {
                const struct super_block *sb_visible = mnt->mnt.mnt_sb;
                struct mount *child;
@@ -6836,8 +6837,7 @@ static bool mnt_already_visible(struct mnt_namespace *ns,
                if (sb_visible->s_iflags & SB_I_RESTRICTED_VARIANT)
                        continue;
 
-               /* A local view of the mount flags */
-               mnt_flags = READ_ONCE(mnt->mnt.mnt_flags);
+               mnt_flags = mnt->mnt.mnt_flags;
 
                /* Don't miss readonly hidden in the superblock flags */
                if (sb_rdonly(mnt->mnt.mnt_sb))
@@ -6865,7 +6865,7 @@ static bool mnt_already_visible(struct mnt_namespace *ns,
                list_for_each_entry(child, &mnt->mnt_mounts, mnt_child) {
                        struct inode *inode = child->mnt_mountpoint->d_inode;
                        /* Only worry about locked mounts */
-                       if (!foreign_ns && !(READ_ONCE(child->mnt.mnt_flags) & 
MNT_LOCKED))
+                       if (!foreign_ns && !(child->mnt.mnt_flags & MNT_LOCKED))
                                continue;
                        /* Is the directory permanently empty? */
                        if (!is_empty_dir_inode(inode))

Reply via email to