]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
blkcg: blkcg_activate_policy() should initialize ancestors first
authorTejun Heo <tj@kernel.org>
Thu, 13 Jun 2019 22:30:40 +0000 (15:30 -0700)
committerJens Axboe <axboe@kernel.dk>
Sat, 15 Jun 2019 16:39:40 +0000 (10:39 -0600)
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 <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-cgroup.c

index 04d286934c5e9175f26d04cff18c53546c20a4ed..440797293235e8e1a477ac975144d9d3dd19e253 100644 (file)
@@ -1390,7 +1390,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])