On Thu, Dec 12, 2024 at 12:56:04PM +0100, Christian Brauner wrote: > @@ -146,6 +147,7 @@ static void mnt_ns_tree_add(struct mnt_namespace *ns) > > mnt_ns_tree_write_lock(); > node = rb_find_add_rcu(&ns->mnt_ns_tree_node, &mnt_ns_tree, mnt_ns_cmp); > + list_add_tail_rcu(&ns->mnt_ns_list, &mnt_ns_list); > mnt_ns_tree_write_unlock(); This only works if the entries are inserted in order -- if not, you can do something like: prev = rb_prev(&ns->mnt_ns_tree_node); if (!prev) { // no previous, add to head list_add(&ns->mnt_ns_list, &mnt_ns_list); } else { // add after the previous tree node prev_ns = container_of(prev, struct mnt_namespace, mnt_ns_tree_node); list_add_tail(&ns->mnt_ns_list, &prev_ns->mnt_ns_list); }