Re: [PATCH v2 2/3] blk-cgroup: skip dying blkg in blkcg_activate_policy()
From: Zheng Qixing
Date: Thu Jan 15 2026 - 04:22:19 EST
You mean 'after'?diff --git a/block/blk-cgroup.c b/block/blk-cgroup.cSo, why this check is still before the pd_alloc_fn()?
index 600f8c5843ea..5dbc107eec53 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -1622,9 +1622,10 @@ int blkcg_activate_policy(struct gendisk *disk, const struct blkcg_policy *pol)
* GFP_NOWAIT failed. Free the existing one and
* prealloc for @blkg w/ GFP_KERNEL.
*/
+ if (!blkg_tryget(blkg))
+ continue;
See blkg_destroy(), can you replace this by the same checking:
list_for_each_entry_reverse()
if (hlist_unhashed(&blkg->blkcg_node))
continue;
if (blkg->pd[pol->plid])
continue;
This change makes sense.
This issue can be resolved by either doing tryget(blkg) before
pd_alloc_fn() or by accessing blkg->blkcg_node.
To keep the behavior consistent with blkg_destroy() and blkg_destroy_all(), I will revise this in v3.
Thank,
Qixing