Skip to content

Commit 282879a

Browse files
committed
pid: rely on common reference count behavior
Now that we changed the generic reference counting mechanism for all namespaces to never manipulate reference counts of initial namespaces we can drop the special handling for pid namespaces. Link: https://patch.msgid.link/20251110-work-namespace-nstree-fixes-v1-15-e8a9264e0fb9@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 7118daa commit 282879a

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

include/linux/pid_namespace.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ static inline struct pid_namespace *to_pid_ns(struct ns_common *ns)
6161

6262
static inline struct pid_namespace *get_pid_ns(struct pid_namespace *ns)
6363
{
64-
if (ns != &init_pid_ns)
65-
ns_ref_inc(ns);
64+
ns_ref_inc(ns);
6665
return ns;
6766
}
6867

kernel/pid_namespace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ struct pid_namespace *copy_pid_ns(u64 flags,
184184

185185
void put_pid_ns(struct pid_namespace *ns)
186186
{
187-
if (ns && ns != &init_pid_ns && ns_ref_put(ns))
187+
if (ns && ns_ref_put(ns))
188188
schedule_work(&ns->work);
189189
}
190190
EXPORT_SYMBOL_GPL(put_pid_ns);

0 commit comments

Comments
 (0)