From 8f96f9b94aafb151b6855f0d9454e2c544e4f59e Mon Sep 17 00:00:00 2001 From: Ming Lei Date: Wed, 27 Mar 2019 09:50:01 +0800 Subject: [PATCH] block: call rq_qos_exit() after queue is frozen mainline inclusion from mainline-4.20-rc1 commit c57cdf7a9e51d97a43e29b8f4a04157875104000 category: bugfix bugzilla: 9630 CVE: NA --------------------------- rq_qos_exit() removes the current q->rq_qos, this action has to be done after queue is frozen, otherwise the IO queue path may never be waken up, then IO hang is caused. So fixes this issue by moving rq_qos_exit() after queue is frozen. Cc: Josef Bacik Signed-off-by: Ming Lei Signed-off-by: Jens Axboe Signed-off-by: Yufen Yu Reviewed-by: Miao Xie Signed-off-by: Yang Yingliang --- block/blk-core.c | 3 +++ block/blk-sysfs.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index e5abef2863b1..3f0a39308266 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -783,6 +783,9 @@ void blk_cleanup_queue(struct request_queue *q) * prevent that q->request_fn() gets invoked after draining finished. */ blk_freeze_queue(q); + + rq_qos_exit(q); + spin_lock_irq(lock); queue_flag_set(QUEUE_FLAG_DEAD, q); spin_unlock_irq(lock); diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c index 3772671cf2bc..d4f1280965b6 100644 --- a/block/blk-sysfs.c +++ b/block/blk-sysfs.c @@ -994,8 +994,6 @@ void blk_unregister_queue(struct gendisk *disk) kobject_del(&q->kobj); blk_trace_remove_sysfs(disk_to_dev(disk)); - rq_qos_exit(q); - mutex_lock(&q->sysfs_lock); if (q->request_fn || (q->mq_ops && q->elevator)) elv_unregister_queue(q); -- GitLab