[PATCH kernel-4.19 openEuler-1.0-LTS] blk-mq: handle all throttled io in blk_cleanup_queue()

From: Yu Kuai <yukuai3@huawei.com> hulk inclusion category: bugfix bugzilla: 182132 CVE: NA ------------------------------------------------- All throttled io will never be issued after blk_throtl_exit() in blk_cleanup_queue(), which will lead to hung. Thus handle throttled io before calling blk_throtl_exit() from blk_exit_queue(). Signed-off-by: Yu Kuai <yukuai3@huawei.com> Reviewed-by: Hou Tao <houtao1@huawei.com> --- block/blk-core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/block/blk-core.c b/block/blk-core.c index 9d2a5a8c78d4..dd3719be9581 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -783,6 +783,16 @@ void blk_cleanup_queue(struct request_queue *q) */ blk_freeze_queue(q); + /* + * All throttled io will never be issued after blk_throtl_exit(), which + * will lead to hung. Thus we need to issue them before calling + * blk_throtl_exit() from blk_exit_queue(). + */ + if (q->mq_ops) { + spin_lock_irq(lock); + blkcg_drain_queue(q); + spin_unlock_irq(lock); + } rq_qos_exit(q); spin_lock_irq(lock); -- 2.25.1
participants (1)
-
Cheng Jian