Skip to contentSkip to conversation

block: call rq_qos_exit() after queue is frozen

PATCH In review Ming Lei 3 participants 3 messages Oct 24, 2018 – Oct 31, 2018 Block layer

lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 block: call rq_qos_exit() after queue is frozen

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.

---
 block/blk-core.c  | 3 +++
 block/blk-sysfs.c | 2 --
 2 files changed, 3 insertions(+), 2 deletions(-)
block/blk-core.c +3 -0
index 3ed60723e242..0a5a6cf5add7 100644
@@ -785,6 +785,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);
block/blk-sysfs.c +0 -2
index 3772671cf2bc..d4f1280965b6 100644
@@ -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);
Signature · 1 line
2.9.5
#1 lore raw
Quoted 42 lines · Ming Lei

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.

---
 block/blk-core.c  | 3 +++
 block/blk-sysfs.c | 2 --
 2 files changed, 3 insertions(+), 2 deletions(-)
block/blk-core.c +3 -0
index 3ed60723e242..0a5a6cf5add7 100644
@@ -785,6 +785,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);
block/blk-sysfs.c +0 -3
index 3772671cf2bc..d4f1280965b6 100644
@@ -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);
--
Quoted 2 lines

2.9.5

Ping...

Signature · 1 line
Ming Lei
maintainer
#2 lore raw
In reply to Ming Lei
Quoted 5 lines · Ming Lei

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.

Looks good, thanks. Applied for 4.20.

Signature · 1 line
Jens Axboe