Thread (71 messages) 71 messages, 7 authors, 2025-09-19

Re: [PATCH v2 18/33] mnt: support ns lookup

From: Al Viro <viro@zeniv.linux.org.uk>
Date: 2025-09-16 03:56:37
Also in: cgroups, linux-block, linux-fsdevel, linux-kselftest, linux-nfs, lkml

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);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help