Linux block layer
 help / color / mirror / Atom feed
* [PATCHv2] blk-mq: blk-mq: check quiesce state before queue_rqs
@ 2021-12-20 20:59 Keith Busch
  2021-12-20 21:04 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Keith Busch @ 2021-12-20 20:59 UTC (permalink / raw)
  To: linux-block, axboe; +Cc: Keith Busch

The low level drivers don't expect to see new requests after a
successful quiesce completes. Check the queue quiesce state within the
rcu protected area prior to calling the driver's queue_rqs().

Signed-off-by: Keith Busch <kbusch@kernel.org>
---
v1->v2:

  Set new function scope to static

 block/blk-mq.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/block/blk-mq.c b/block/blk-mq.c
index 51991232824a..998a85b5b46c 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2549,6 +2549,14 @@ static void blk_mq_plug_issue_direct(struct blk_plug *plug, bool from_schedule)
 		blk_mq_commit_rqs(hctx, &queued, from_schedule);
 }
 
+static void __blk_mq_flush_plug_list(struct request_queue *q,
+				     struct blk_plug *plug)
+{
+	if (blk_queue_quiesced(q))
+		return;
+	q->mq_ops->queue_rqs(&plug->mq_list);
+}
+
 void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
 {
 	struct blk_mq_hw_ctx *this_hctx;
@@ -2580,7 +2588,7 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
 		if (q->mq_ops->queue_rqs &&
 		    !(rq->mq_hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED)) {
 			blk_mq_run_dispatch_ops(q,
-				q->mq_ops->queue_rqs(&plug->mq_list));
+				__blk_mq_flush_plug_list(q, plug));
 			if (rq_list_empty(plug->mq_list))
 				return;
 		}
-- 
2.25.4


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

* Re: [PATCHv2] blk-mq: blk-mq: check quiesce state before queue_rqs
  2021-12-20 20:59 [PATCHv2] blk-mq: blk-mq: check quiesce state before queue_rqs Keith Busch
@ 2021-12-20 21:04 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-12-20 21:04 UTC (permalink / raw)
  To: Keith Busch, linux-block

On 12/20/21 1:59 PM, Keith Busch wrote:
> The low level drivers don't expect to see new requests after a
> successful quiesce completes. Check the queue quiesce state within the
> rcu protected area prior to calling the driver's queue_rqs().

Thanks, applied - I added a Fixes tag as well.

-- 
Jens Axboe


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

end of thread, other threads:[~2021-12-20 21:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-20 20:59 [PATCHv2] blk-mq: blk-mq: check quiesce state before queue_rqs Keith Busch
2021-12-20 21:04 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox