aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2025-09-17 12:28:05 +0200
committerChristian Brauner <brauner@kernel.org>2025-09-19 14:26:18 +0200
commit86cdbae5c61c6b8c0a2adc78dbbb0314b3254a9c (patch)
tree5f13878481488bd19369393fcd2814f9ea0d3609 /fs/namespace.c
parentcc47f434271ba90c18c16e0bba360df38a8bc954 (diff)
downloadrandom-86cdbae5c61c6b8c0a2adc78dbbb0314b3254a9c.tar.gz
mnt: simplify ns_common_init() handling
Assign the reserved MNT_NS_ANON_INO sentinel to anonymous mount namespaces and cleanup the initial mount ns allocation. This is just a preparatory patch and the ns->inum check in ns_common_init() will be dropped in the next patch. Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index f0bddc9cf2a6d5..b2fcb901ad8c1e 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -4103,6 +4103,8 @@ static struct mnt_namespace *alloc_mnt_ns(struct user_namespace *user_ns, bool a
return ERR_PTR(-ENOMEM);
}
+ if (anon)
+ new_ns->ns.inum = MNT_NS_ANON_INO;
ret = ns_common_init(&new_ns->ns, &mntns_operations, !anon);
if (ret) {
kfree(new_ns);