Skip to content

Commit

Permalink
blk-mq: blk-mq: check quiesce state before queue_rqs
Browse files Browse the repository at this point in the history
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().

Fixes: 3c67d44 ("block: add mq_ops->queue_rqs hook")
Signed-off-by: Keith Busch <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
keithbusch authored and axboe committed Dec 20, 2021
1 parent 361c81d commit 518579a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 518579a

Please sign in to comment.