On Fri, Sep 12, 2025 at 01:52:41PM +0200, Christian Brauner wrote:
Move the mount namespace to the generic ns lookup infrastructure. This allows us to drop a bunch of members from struct mnt_namespace.
static void mnt_ns_tree_remove(struct mnt_namespace *ns) { /* remove from global mount namespace list */
- if (!is_anon_ns(ns)) {
mnt_ns_tree_write_lock();
rb_erase(&ns->mnt_ns_tree_node, &mnt_ns_tree);
list_bidir_del_rcu(&ns->mnt_ns_list);
mnt_ns_tree_write_unlock();
- }
- call_rcu(&ns->mnt_ns_rcu, mnt_ns_release_rcu);
-}
-static int mnt_ns_find(const void *key, const struct rb_node *node) -{
- const u64 mnt_ns_id = *(u64 *)key;
- const struct mnt_namespace *ns = node_to_mnt_ns(node);
- if (!is_anon_ns(ns))
ns_tree_remove(ns);
Conflicts with "mnt_ns_tree_remove(): DTRT if mnt_ns had never been added to mnt_ns_list".
FWIW, the right thing to do here is
if (!RB_EMPTY_NODE(to_ns_common(ns)->ns_tree_node)) ns_tree_remove(ns);