summaryrefslogtreecommitdiff
path: root/fs/namespace.c
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2025-11-10 16:08:22 +0100
committerChristian Brauner <brauner@kernel.org>2025-11-11 10:01:31 +0100
commitd9a44089ac7754e470dfdaf3658c3455b2d7f7dd (patch)
treef2328d7cb80a77dbd9d1459c38ffad0557d72378 /fs/namespace.c
parent6bf253855aa8c970d2191f87ee23f9f184ddaa79 (diff)
fs: use boolean to indicate anonymous mount namespace
Stop playing games with the namespace id and use a boolean instead: * This will remove the special-casing we need to do everywhere for mount namespaces. * It will allow us to use asserts on the namespace id for initial namespaces everywhere. * It will allow us to put anonymous mount namespaces on the namespaces trees in the future and thus make them available to statmount() and listmount(). Link: https://patch.msgid.link/20251110-work-namespace-nstree-fixes-v1-10-e8a9264e0fb9@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index ad19530a13b2..efaff8680eaf 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -4093,8 +4093,9 @@ static struct mnt_namespace *alloc_mnt_ns(struct user_namespace *user_ns, bool a
dec_mnt_namespaces(ucounts);
return ERR_PTR(ret);
}
- if (!anon)
- ns_tree_gen_id(new_ns);
+ ns_tree_gen_id(new_ns);
+
+ new_ns->is_anon = anon;
refcount_set(&new_ns->passive, 1);
new_ns->mounts = RB_ROOT;
init_waitqueue_head(&new_ns->poll);