aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/net_namespace.c
diff options
context:
space:
mode:
authorChristian Brauner <[email protected]>2025-06-11 09:59:13 +0000
committerChristian Brauner <[email protected]>2025-06-11 09:59:13 +0000
commitcd267cdef5fe98006a6b989c5cda035032bb839f (patch)
tree552a87c24c71f2fbaa69871a470889dda0ca9896 /net/core/net_namespace.c
parentLinux 6.16-rc1 (diff)
parentmntns: use stable inode number for initial mount ns (diff)
downloadkernel-cd267cdef5fe98006a6b989c5cda035032bb839f.tar.gz
kernel-cd267cdef5fe98006a6b989c5cda035032bb839f.zip
Merge patch series "nsfs: expose the stable inode numbers in a public header"
Christian Brauner <[email protected]> says: Userspace heavily relies on the root inode numbers for namespaces to identify the initial namespaces. That's already a hard dependency. So we cannot change that anymore. Move the initial inode numbers to a public header and align the only two namespaces that currently don't do that with all the other namespaces. * patches from https://lore.kernel.org/[email protected]: mntns: use stable inode number for initial mount ns netns: use stable inode number for initial mount ns nsfs: move root inode number to uapi Link: https://lore.kernel.org/[email protected] Signed-off-by: Christian Brauner <[email protected]>
Diffstat (limited to 'net/core/net_namespace.c')
-rw-r--r--net/core/net_namespace.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index ae54f26709ca..03cf87d3b380 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -796,11 +796,19 @@ static __net_init int net_ns_net_init(struct net *net)
#ifdef CONFIG_NET_NS
net->ns.ops = &netns_operations;
#endif
+ if (net == &init_net) {
+ net->ns.inum = PROC_NET_INIT_INO;
+ return 0;
+ }
return ns_alloc_inum(&net->ns);
}
static __net_exit void net_ns_net_exit(struct net *net)
{
+ /*
+ * Initial network namespace doesn't exit so we don't need any
+ * special checks here.
+ */
ns_free_inum(&net->ns);
}