[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250916035633.GM39973@ZenIV>
Date: Tue, 16 Sep 2025 04:56:33 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Christian Brauner <brauner@...nel.org>
Cc: Jan Kara <jack@...e.cz>, Amir Goldstein <amir73il@...il.com>,
linux-fsdevel@...r.kernel.org, Josef Bacik <josef@...icpanda.com>,
Jeff Layton <jlayton@...nel.org>, Mike Yuan <me@...dnzj.com>,
Zbigniew Jędrzejewski-Szmek <zbyszek@...waw.pl>,
Lennart Poettering <mzxreary@...inter.de>,
Daan De Meyer <daan.j.demeyer@...il.com>,
Aleksa Sarai <cyphar@...har.com>, Jens Axboe <axboe@...nel.dk>,
Tejun Heo <tj@...nel.org>, Johannes Weiner <hannes@...xchg.org>,
Michal Koutný <mkoutny@...e.com>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>,
Chuck Lever <chuck.lever@...cle.com>, linux-nfs@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, cgroups@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH v2 18/33] mnt: support ns lookup
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);
Powered by blists - more mailing lists