linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] blk-mq: properly drain stopped queues
@ 2014-06-13 17:43 Christoph Hellwig
  2014-06-13 17:43 ` [PATCH 2/2] blk-mq: merge blk_mq_drain_queue and __blk_mq_drain_queue Christoph Hellwig
  2014-06-13 18:17 ` [PATCH 1/2] blk-mq: properly drain stopped queues Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Christoph Hellwig @ 2014-06-13 17:43 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel

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 <bvanassche@acm.org>
Tested-by: Bart Van Assche <bvanassche@acm.org>
---
 block/blk-mq.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 3d868d3..15b3ccd 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -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);
 	}
 }
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] blk-mq: merge blk_mq_drain_queue and __blk_mq_drain_queue
  2014-06-13 17:43 [PATCH 1/2] blk-mq: properly drain stopped queues Christoph Hellwig
@ 2014-06-13 17:43 ` Christoph Hellwig
  2014-06-13 18:17 ` [PATCH 1/2] blk-mq: properly drain stopped queues Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2014-06-13 17:43 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 block/blk-mq.c |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 15b3ccd..a719340 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -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)
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] blk-mq: properly drain stopped queues
  2014-06-13 17:43 [PATCH 1/2] blk-mq: properly drain stopped queues Christoph Hellwig
  2014-06-13 17:43 ` [PATCH 2/2] blk-mq: merge blk_mq_drain_queue and __blk_mq_drain_queue Christoph Hellwig
@ 2014-06-13 18:17 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2014-06-13 18:17 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-kernel

On 06/13/2014 11:43 AM, Christoph Hellwig wrote:
> 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!

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-06-13 18:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-13 17:43 [PATCH 1/2] blk-mq: properly drain stopped queues Christoph Hellwig
2014-06-13 17:43 ` [PATCH 2/2] blk-mq: merge blk_mq_drain_queue and __blk_mq_drain_queue Christoph Hellwig
2014-06-13 18:17 ` [PATCH 1/2] blk-mq: properly drain stopped queues Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).