[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Mon, 10 Oct 2022 10:24:03 -1000
From: Tejun Heo <tj@...nel.org>
To: Michal Koutný <mkoutny@...e.com>
Cc: cgroups@...r.kernel.org, dan.carpenter@...cle.com,
hannes@...xchg.org, linux-kernel@...r.kernel.org,
lizefan.x@...edance.com
Subject: Re: [PATCH v3] cgroup: Reorganize css_set_lock and kernfs path
processing
On Mon, Oct 10, 2022 at 10:29:18AM +0200, Michal Koutný wrote:
> The commit 74e4b956eb1c incorrectly wrapped kernfs_walk_and_get
> (might_sleep) under css_set_lock (spinlock). css_set_lock is needed by
> __cset_cgroup_from_root to ensure stable cset->cgrp_links but not for
> kernfs_walk_and_get.
>
> We only need to make sure that the returned root_cgrp won't be freed
> under us. This is given in the case of global root because it is static
> (cgrp_dfl_root.cgrp). When the root_cgrp is lower in the hierarchy, it
> is pinned by cgroup_ns->root_cset (and `current` task cannot switch
> namespace asynchronously so ns_proxy pins cgroup_ns).
>
> Note this reasoning won't hold for root cgroups in v1 hierarchies,
> therefore create a special-cased helper function just for the default
> hierarchy.
>
> Fixes: 74e4b956eb1c ("cgroup: Honor caller's cgroup NS when resolving path")
> Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> Signed-off-by: Michal Koutný <mkoutny@...e.com>
Applied to cgroup/for-6.1-fixes w/ trivial comment / line break adjustments.
Thanks.
--
tejun
Powered by blists - more mailing lists