Re: [PATCH v4 0/4] blk-cgroup: fix blkg list and policy data races

Nilay Shroff <[email protected]> Mon, 3 Aug 2026 14:39:14 +0530
Newsgroups org.kernel.vger.linux-block,org.kernel.vger.cgroups,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 8/3/26 1:50 PM, yu kuai wrote:
> Hi,
> 
> 在 2026/8/3 14:51, Nilay Shroff 写道:
>> On 8/2/26 4:55 PM, Yu Kuai wrote:
>>> From: Yu Kuai <[email protected]>
>>>
>>> This set fix some problems that are reported long time ago with
>>> minimal changes,
>>> the blkcg_mutex refactor I'm working on can fix these problems as
>>> well, but it's
>>> complicated and may not land in this merge window. So I think this
>>> set should land
>>> in this merge window first.
>>>
>>> Patch 1 protects blkg_destroy_all()'s q->blkg_list walk with
>>> blkcg_mutex.
>>>
>>> Patches 2-3 fix races between blkcg_activate_policy() and concurrent
>>> blkg destruction.
>>>
>>> Patch 4 factors the policy data teardown loop into a helper after the
>>> race fixes.
>>>
>>
>> This series looks good to me, however as I recall, we discussed about
>> protecting blkg_create() as well using ->blkcg_mutex. I remember the
>> blkg_create() is not protected with ->blkcg_mutex under each call path,
>> so would you to also cover that change in this patchset?
> 
> I can't do this for now without a big refactor, because it's possible that
> blkg_create() can be called from bio_set_dev(), and bio_set_dev() can be
> called from many atomic contexts, examples are patch 1,2,3,5,8,9,10 from the
> following RFC v1 set:
> 
> [RFC PATCH v1 00/17] blk-cgroup: protect blkgs with blkcg_mutex - Yu Kuai <https://lore.kernel.org/all/[email protected]/>
> 
Okay understood. With that, for this entire patchset:

Reviewed-by: Nilay Shroff <[email protected]>