aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2025-11-10 16:08:28 +0100
committerChristian Brauner <brauner@kernel.org>2025-11-11 10:01:32 +0100
commitc2bbd2db521b018c59fb0ff8e1cdfa8ee907ba88 (patch)
treee4919cf0b92c2a564d606078f9f824aad295fdde
parent282879afa01936954a570e15b4088a89b6e1b549 (diff)
downloadnet-c2bbd2db521b018c59fb0ff8e1cdfa8ee907ba88.tar.gz
ns: drop custom reference count initialization for initial namespaces
Initial namespaces don't modify their reference count anymore. They remain fixed at one so drop the custom refcount initializations. Link: https://patch.msgid.link/20251110-work-namespace-nstree-fixes-v1-16-e8a9264e0fb9@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
-rw-r--r--fs/namespace.c2
-rw-r--r--include/linux/ns_common.h4
-rw-r--r--init/version-timestamp.c2
-rw-r--r--ipc/msgutil.c2
-rw-r--r--kernel/cgroup/cgroup.c2
-rw-r--r--kernel/pid.c2
-rw-r--r--kernel/time/namespace.c2
-rw-r--r--kernel/user.c2
8 files changed, 9 insertions, 9 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index efaff8680eafbd..25289b869be15e 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -5986,7 +5986,7 @@ SYSCALL_DEFINE4(listmount, const struct mnt_id_req __user *, req,
}
struct mnt_namespace init_mnt_ns = {
- .ns = NS_COMMON_INIT(init_mnt_ns, 1),
+ .ns = NS_COMMON_INIT(init_mnt_ns),
.user_ns = &init_user_ns,
.passive = REFCOUNT_INIT(1),
.mounts = RB_ROOT,
diff --git a/include/linux/ns_common.h b/include/linux/ns_common.h
index 43f709ab846a72..136f6a322e5369 100644
--- a/include/linux/ns_common.h
+++ b/include/linux/ns_common.h
@@ -26,14 +26,14 @@ static __always_inline bool is_ns_init_id(const struct ns_common *ns)
return ns->ns_id <= NS_LAST_INIT_ID;
}
-#define NS_COMMON_INIT(nsname, refs) \
+#define NS_COMMON_INIT(nsname) \
{ \
.ns_type = ns_common_type(&nsname), \
.ns_id = ns_init_id(&nsname), \
.inum = ns_init_inum(&nsname), \
.ops = to_ns_operations(&nsname), \
.stashed = NULL, \
- .__ns_ref = REFCOUNT_INIT(refs), \
+ .__ns_ref = REFCOUNT_INIT(1), \
.__ns_ref_active = ATOMIC_INIT(1), \
.ns_unified_node.ns_list_entry = LIST_HEAD_INIT(nsname.ns.ns_unified_node.ns_list_entry), \
.ns_tree_node.ns_list_entry = LIST_HEAD_INIT(nsname.ns.ns_tree_node.ns_list_entry), \
diff --git a/init/version-timestamp.c b/init/version-timestamp.c
index 56ded64fdfe409..375726e05f690f 100644
--- a/init/version-timestamp.c
+++ b/init/version-timestamp.c
@@ -8,7 +8,7 @@
#include <linux/utsname.h>
struct uts_namespace init_uts_ns = {
- .ns = NS_COMMON_INIT(init_uts_ns, 2),
+ .ns = NS_COMMON_INIT(init_uts_ns),
.name = {
.sysname = UTS_SYSNAME,
.nodename = UTS_NODENAME,
diff --git a/ipc/msgutil.c b/ipc/msgutil.c
index 55a908ec0674c6..e28f0cecb2ec94 100644
--- a/ipc/msgutil.c
+++ b/ipc/msgutil.c
@@ -27,7 +27,7 @@ DEFINE_SPINLOCK(mq_lock);
* and not CONFIG_IPC_NS.
*/
struct ipc_namespace init_ipc_ns = {
- .ns = NS_COMMON_INIT(init_ipc_ns, 1),
+ .ns = NS_COMMON_INIT(init_ipc_ns),
.user_ns = &init_user_ns,
};
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 20ab84b2cf4e08..2bf3951ca88f63 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -250,7 +250,7 @@ bool cgroup_enable_per_threadgroup_rwsem __read_mostly;
/* cgroup namespace for init task */
struct cgroup_namespace init_cgroup_ns = {
- .ns = NS_COMMON_INIT(init_cgroup_ns, 2),
+ .ns = NS_COMMON_INIT(init_cgroup_ns),
.user_ns = &init_user_ns,
.root_cset = &init_css_set,
};
diff --git a/kernel/pid.c b/kernel/pid.c
index a5a63dc0a49171..a31771bc89c1a3 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -71,7 +71,7 @@ static int pid_max_max = PID_MAX_LIMIT;
* the scheme scales to up to 4 million PIDs, runtime.
*/
struct pid_namespace init_pid_ns = {
- .ns = NS_COMMON_INIT(init_pid_ns, 2),
+ .ns = NS_COMMON_INIT(init_pid_ns),
.idr = IDR_INIT(init_pid_ns.idr),
.pid_allocated = PIDNS_ADDING,
.level = 0,
diff --git a/kernel/time/namespace.c b/kernel/time/namespace.c
index 19911f88e2b88d..e76be24b132cf5 100644
--- a/kernel/time/namespace.c
+++ b/kernel/time/namespace.c
@@ -478,7 +478,7 @@ const struct proc_ns_operations timens_for_children_operations = {
};
struct time_namespace init_time_ns = {
- .ns = NS_COMMON_INIT(init_time_ns, 3),
+ .ns = NS_COMMON_INIT(init_time_ns),
.user_ns = &init_user_ns,
.frozen_offsets = true,
};
diff --git a/kernel/user.c b/kernel/user.c
index 4b3132e786d943..7aef4e679a6a0c 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -35,7 +35,7 @@ EXPORT_SYMBOL_GPL(init_binfmt_misc);
* and 1 for... ?
*/
struct user_namespace init_user_ns = {
- .ns = NS_COMMON_INIT(init_user_ns, 3),
+ .ns = NS_COMMON_INIT(init_user_ns),
.uid_map = {
{
.extent[0] = {