Re: [PATCH v4 0/4] blk-cgroup: fix blkg list and policy data races
From: Nilay Shroff
Date: Mon Aug 03 2026 - 05:16:36 EST
On 8/3/26 1:50 PM, yu kuai wrote:
Hi,Okay understood. With that, for this entire patchset:
在 2026/8/3 14:51, Nilay Shroff 写道:
On 8/2/26 4:55 PM, Yu Kuai wrote:
From: Yu Kuai <yukuai@xxxxxxx>
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/20260704195124.1375075-1-yukuai@xxxxxxxxxx/>
Reviewed-by: Nilay Shroff <nilay@xxxxxxxxxxxxx>