blk-cgroup: fix blkg list and policy data races
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest5 patches 5 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | blk-cgroup: protect q->blkg_list iteration in blkg_destroy_all() with blkcg_mutexblock/ | +3 | 0 replies | |
| 2/5 | bfq: protect q->blkg_list iteration in bfq_end_wr_async() with blkcg_mutexblock/ block/ | +8 | 2 replies | |
| 3/5 | blk-cgroup: fix race between policy activation and blkg destructionblock/ | +3 | 0 replies | |
| 4/5 | blk-cgroup: skip dying blkg in blkcg_activate_policy()block/ | +2 | 0 replies | |
| 5/5 | blk-cgroup: factor policy pd teardown loop into helperblock/ | +27 | 0 replies |
Reviews trailers per patch
1 of 5 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Christoph Hellwig | Yu Kuai | Tang Yizhou |
|---|---|---|---|
| Series | R-b | ||
| 1/5 | |||
| 2/5 | |||
| 3/5 | |||
| 4/5 | |||
| 5/5 | R-b | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH 0/5] blk-cgroup: fix blkg list and policy data races
This small series fixes races between blkg destruction, q->blkg_list iteration, and blkcg policy activation.
The first two patches serialize q->blkg_list walks in blkg_destroy_all() and BFQ writeback weight-raising teardown with blkcg_mutex. The next two patches close policy activation races with concurrent blkg destruction, including skipping blkgs that are already dying. The final patch factors the common policy data teardown loop.
This uses blkcg_mutex rather than extending queue_lock coverage because the races are about blkg list visibility and policy-data lifetime, not request-queue dispatch state. blkg_free_workfn() already uses blkcg_mutex to serialize policy-data freeing with policy deactivation and removes blkgs from q->blkg_list only after that teardown. Taking the same mutex around the remaining q->blkg_list walkers gives one sleepable serialization point for blkg lifetime, avoids adding more queue_lock nesting, and prepares the follow-up conversion that removes queue_lock from blkcg list protection entirely.
Yu Kuai (2):
blk-cgroup: protect q->blkg_list iteration in blkg_destroy_all() with
blkcg_mutex
bfq: protect q->blkg_list iteration in bfq_end_wr_async() with
blkcg_mutex
Zheng Qixing (3):
blk-cgroup: fix race between policy activation and blkg destruction
blk-cgroup: skip dying blkg in blkcg_activate_policy()
blk-cgroup: factor policy pd teardown loop into helper
block/bfq-cgroup.c | 3 ++- block/bfq-iosched.c | 6 +++++ block/blk-cgroup.c | 65 ++++++++++++++++++++++++--------------------- 3 files changed, 43 insertions(+), 31 deletions(-)
Signature · 1 line
2.51.0