From 0ae44a20835e5cf37d03a83e70c92e92deda3703 Mon Sep 17 00:00:00 2001 From: Guopeng Zhang Date: Mon, 1 Jun 2026 11:29:11 +0800 Subject: [PATCH 1/2] fs/namespace: notify pollers of legacy propagation changes Changing mount propagation through the legacy mount API changes user-visible mountinfo contents, including the shared: and master: optional fields. The mount_setattr() path already touches the mount namespace after change_mnt_propagation(), so pollers of /proc//mountinfo are woken when the namespace event changes. The legacy mount --make-* path also changes propagation through change_mnt_propagation(), and MOVE_MOUNT_SET_GROUP updates the propagation relationship of the target mount. Both paths currently return without touching the affected mount namespace. As a result, userspace polling /proc//mountinfo can miss these propagation-only changes even though mountinfo has changed. A simple reproducer that polls /proc/self/mountinfo while changing propagation shows the inconsistency. Before this change: legacy MS_SHARED: poll ret=0 revents=0x0 mount_setattr MS_SHARED: poll ret=1 revents=0xa After this change: legacy MS_SHARED: poll ret=1 revents=0xa mount_setattr MS_SHARED: poll ret=1 revents=0xa Fix this by touching the affected mount namespace after successful propagation changes in do_change_type() and do_set_group(). Signed-off-by: Guopeng Zhang Link: https://patch.msgid.link/20260601032911.940507-1-guopeng.zhang@linux.dev Signed-off-by: Christian Brauner (Amutable) --- fs/namespace.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/namespace.c b/fs/namespace.c index 3d5cd5bf3b05..52ee1e9f4f93 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2908,6 +2908,9 @@ static int do_change_type(const struct path *path, int ms_flags) for (m = mnt; m; m = (recurse ? next_mnt(m, mnt) : NULL)) change_mnt_propagation(m, type); + guard(mount_locked_reader)(); + touch_mnt_namespace(mnt->mnt_ns); + return 0; } @@ -3481,6 +3484,10 @@ static int do_set_group(const struct path *from_path, const struct path *to_path list_add(&to->mnt_share, &from->mnt_share); set_mnt_shared(to); } + + guard(mount_locked_reader)(); + touch_mnt_namespace(to->mnt_ns); + return 0; } From 083e8742e301a24f0c458696b45b481345888b85 Mon Sep 17 00:00:00 2001 From: Hamza Mahfooz Date: Mon, 20 Jul 2026 07:23:31 -0400 Subject: [PATCH 2/2] mount: remove redundant panic() in mnt_init() Since at least as far back as commit 0818bf27c05b ("resizable namespace.c hashes"), we call alloc_large_system_hash() in mnt_init() which already panics if the table is NULL. Signed-off-by: Hamza Mahfooz Link: https://patch.msgid.link/20260720112331.1096530-1-hamzamahfooz@linux.microsoft.com Reviewed-by: Jori Koolstra Signed-off-by: Christian Brauner (Amutable) --- fs/namespace.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index 52ee1e9f4f93..4fcd4eb71c5a 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -6266,9 +6266,6 @@ void __init mnt_init(void) HASH_ZERO, &mp_hash_shift, &mp_hash_mask, 0, 0); - if (!mount_hashtable || !mountpoint_hashtable) - panic("Failed to allocate mount hash table\n"); - kernfs_init(); err = sysfs_init();