Skip to content

Commit 8b37bc2

Browse files
Jiufei Xueaxboe
authored andcommitted
iocost: check active_list of all the ancestors in iocg_activate()
There is a bug that checking the same active_list over and over again in iocg_activate(). The intention of the code was checking whether all the ancestors and self have already been activated. So fix it. Fixes: 7caa471 ("blkcg: implement blk-iocost") Acked-by: Tejun Heo <[email protected]> Signed-off-by: Jiufei Xue <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 478de33 commit 8b37bc2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

block/blk-iocost.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,9 +1057,12 @@ static bool iocg_activate(struct ioc_gq *iocg, struct ioc_now *now)
10571057
atomic64_set(&iocg->active_period, cur_period);
10581058

10591059
/* already activated or breaking leaf-only constraint? */
1060-
for (i = iocg->level; i > 0; i--)
1061-
if (!list_empty(&iocg->active_list))
1060+
if (!list_empty(&iocg->active_list))
1061+
goto succeed_unlock;
1062+
for (i = iocg->level - 1; i > 0; i--)
1063+
if (!list_empty(&iocg->ancestors[i]->active_list))
10621064
goto fail_unlock;
1065+
10631066
if (iocg->child_active_sum)
10641067
goto fail_unlock;
10651068

@@ -1101,6 +1104,7 @@ static bool iocg_activate(struct ioc_gq *iocg, struct ioc_now *now)
11011104
ioc_start_period(ioc, now);
11021105
}
11031106

1107+
succeed_unlock:
11041108
spin_unlock_irq(&ioc->lock);
11051109
return true;
11061110

0 commit comments

Comments
 (0)