From 94e9f8d4ef8af48c0d6c1c062585180d6c056b40 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Thu, 13 Jun 2019 15:30:40 -0700 Subject: [PATCH] blkcg: blkcg_activate_policy() should initialize ancestors first commit 71c814077de60b2e7415dac6f5c4e98f59d521fd upstream. When blkcg_activate_policy() is creating blkg_policy_data for existing blkgs, it did in the wrong order - descendants first. Fix it. None of the existing controllers seem affected by this. Signed-off-by: Tejun Heo Signed-off-by: Jens Axboe Signed-off-by: Jiufei Xue Reviewed-by: Joseph Qi --- block/blk-cgroup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index d5ec7f9b460d..f89bd84a180f 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -1443,7 +1443,8 @@ int blkcg_activate_policy(struct request_queue *q, spin_lock_irq(q->queue_lock); - list_for_each_entry(blkg, &q->blkg_list, q_node) { + /* blkg_list is pushed at the head, reverse walk to init parents first */ + list_for_each_entry_reverse(blkg, &q->blkg_list, q_node) { struct blkg_policy_data *pd; if (blkg->pd[pol->plid]) -- GitLab