blk-mq: properly drain stopped queues
PATCH 1/2 blk-mq: properly drain stopped queues
If we need to drain a queue we need to run all queues, even if they are marked stopped to make sure the driver has a chance to error out on all queued requests.
This fixes surprise removal with scsi-mq.
Reported-by Bart Van Assche <[email protected]>
Tested-by Bart Van Assche <[email protected]>
--- block/blk-mq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/blk-mq.c +1 -1
@@ -120,7 +120,7 @@ static void __blk_mq_drain_queue(struct request_queue *q)if (count ==0 )break ; -blk_mq_run_queues (q, false); +blk_mq_start_hw_queues (q);msleep (10 ); } }
Signature · 1 line
1.7.10.4
PATCH 2/2 blk-mq: merge blk_mq_drain_queue and __blk_mq_drain_queue
Signed-off-by Christoph Hellwig <[email protected]>
--- block/blk-mq.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
block/blk-mq.c +2 -7
@@ -109,7 +109,7 @@ static void blk_mq_queue_exit(struct request_queue *q)__percpu_counter_add (&q->mq_usage_counter,-1 ,1000000 ); } -static void __blk_mq_drain_queue (struct request_queue *q) +void blk_mq_drain_queue (struct request_queue *q) {while (true) {s64 count;
@@ -139,12 +139,7 @@ static void blk_mq_freeze_queue(struct request_queue *q)spin_unlock_irq (q->queue_lock);if (drain) -__blk_mq_drain_queue (q); -} - -void blk_mq_drain_queue (struct request_queue *q) -{ -__blk_mq_drain_queue (q); +blk_mq_drain_queue (q); }static void blk_mq_unfreeze_queue (struct request_queue *q)
Signature · 1 line
1.7.10.4
Quoted 5 lines · Christoph Hellwig
If we need to drain a queue we need to run all queues, even if they are marked stopped to make sure the driver has a chance to error out on all queued requests.
This fixes surprise removal with scsi-mq.
Applied this and 2/2 as well, thanks!
Signature · 1 line
Jens Axboe