Re: [PATCH v3 11/70] ns: add active reference count
From: Askar Safin <hidden>
Date: 2025-10-29 07:02:11
Also in:
bpf, cgroups, linux-fsdevel, lkml
Christian Brauner [off-list ref]:
Currently namespace file handles allow much broader access to namespaces than what is currently possible via (1)-(4). The reason is that
There is no any (4) here.
On current kernels a namespace is visible to userspace in the following cases:
[...]
(3) The namespace is a hierarchical namespace type and is the parent of
a single or multiple child namespaces.[...]
To handle this nicely we introduce an active reference count which tracks (1)-(3). This is easy to do as all of these things are already
[...]
+ * Inactive -> Active: + * When walking a hierarchical namespace tree upwards and reopening + * parent namespaces via NS_GET_PARENT that only exist because they + * are a parent of an actively used namespace it is possible to + * necrobump an inactive namespace back to the active state.
These quoted parts contradict to each other. You say "we introduce an active reference count which tracks (1)-(3)", and (3) says "The namespace is a hierarchical namespace type and is the parent of a single or multiple child namespaces". I. e. active reference will count such parents. But then in code you say:
+ * Inactive -> Active: + * When walking a hierarchical namespace tree upwards and reopening + * parent namespaces via NS_GET_PARENT that only exist because they + * are a parent of an actively used namespace it is possible to + * necrobump an inactive namespace back to the active state.
I. e. now you say that such parents are inactive and can become active. -- Askar Safin