提交 a8dc8024 编写于 作者: J Jiufei Xue 提交者: Yang Yingliang

iocost: check active_list of all the ancestors in iocg_activate()

mainline inclusion
from mainline-5.4-rc8
commit 8b37bc27
category: feature
bugzilla: 38688
CVE: NA

---------------------------

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: 7caa4715 ("blkcg: implement blk-iocost")
Acked-by: NTejun Heo <tj@kernel.org>
Signed-off-by: NJiufei Xue <jiufei.xue@linux.alibaba.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NYu Kuai <yukuai3@huawei.com>
Reviewed-by: NHou Tao <houtao1@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 e07037c5
...@@ -1057,9 +1057,12 @@ static bool iocg_activate(struct ioc_gq *iocg, struct ioc_now *now) ...@@ -1057,9 +1057,12 @@ static bool iocg_activate(struct ioc_gq *iocg, struct ioc_now *now)
atomic64_set(&iocg->active_period, cur_period); atomic64_set(&iocg->active_period, cur_period);
/* already activated or breaking leaf-only constraint? */ /* already activated or breaking leaf-only constraint? */
for (i = iocg->level; i > 0; i--) if (!list_empty(&iocg->active_list))
if (!list_empty(&iocg->active_list)) goto succeed_unlock;
for (i = iocg->level - 1; i > 0; i--)
if (!list_empty(&iocg->ancestors[i]->active_list))
goto fail_unlock; goto fail_unlock;
if (iocg->child_active_sum) if (iocg->child_active_sum)
goto fail_unlock; goto fail_unlock;
...@@ -1101,6 +1104,7 @@ static bool iocg_activate(struct ioc_gq *iocg, struct ioc_now *now) ...@@ -1101,6 +1104,7 @@ static bool iocg_activate(struct ioc_gq *iocg, struct ioc_now *now)
ioc_start_period(ioc, now); ioc_start_period(ioc, now);
} }
succeed_unlock:
spin_unlock_irq(&ioc->lock); spin_unlock_irq(&ioc->lock);
return true; return true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册