]> git.baikalelectronics.ru Git - kernel.git/commitdiff
blk-cgroup: fix missing pd_online_fn() while activating policy
authorYu Kuai <yukuai3@huawei.com>
Tue, 3 Jan 2023 11:28:33 +0000 (19:28 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Feb 2023 06:52:48 +0000 (07:52 +0100)
[ Upstream commit e3ff8887e7db757360f97634e0d6f4b8e27a8c46 ]

If the policy defines pd_online_fn(), it should be called after
pd_init_fn(), like blkg_create().

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20230103112833.2013432-1-yukuai1@huaweicloud.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
block/blk-cgroup.c

index dde8d0acfb34f04d2172f7f5284f7917addf6a71..cd085a0e5e4a7939ff7143a245fa4b356364ca88 100644 (file)
@@ -1445,6 +1445,10 @@ retry:
                list_for_each_entry_reverse(blkg, &q->blkg_list, q_node)
                        pol->pd_init_fn(blkg->pd[pol->plid]);
 
+       if (pol->pd_online_fn)
+               list_for_each_entry_reverse(blkg, &q->blkg_list, q_node)
+                       pol->pd_online_fn(blkg->pd[pol->plid]);
+
        __set_bit(pol->plid, q->blkcg_pols);
        ret = 0;