summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorMing Lei <ming.lei@redhat.com>2021-12-06 11:33:50 +0800
committerJens Axboe <axboe@kernel.dk>2021-12-06 09:41:40 -0700
commit73f3760eddc9bc32c207fff06537f98f94bef451 (patch)
tree950ca905ee857f17114ad89a63c9787eb9d5c2cb /block
parent41adf531e390e7969f00a560b8971cbf42f5a6da (diff)
blk-mq: don't use plug->mq_list->q directly in blk_mq_run_dispatch_ops()
blk_mq_run_dispatch_ops() is defined as one macro, and plug->mq_list will be changed when running 'dispatch_ops', so add one local variable for holding request queue. Reported-and-tested-by: Yi Zhang <yi.zhang@redhat.com> Fixes: 4cafe86c9267 ("blk-mq: run dispatch lock once in case of issuing from list") Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/blk-mq.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 706e9a836fe6..0bf3523dd1f5 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -2521,7 +2521,9 @@ void blk_mq_flush_plug_list(struct blk_plug *plug, bool from_schedule)
plug->rq_count = 0;
if (!plug->multiple_queues && !plug->has_elevator && !from_schedule) {
- blk_mq_run_dispatch_ops(plug->mq_list->q,
+ struct request_queue *q = rq_list_peek(&plug->mq_list)->q;
+
+ blk_mq_run_dispatch_ops(q,
blk_mq_plug_issue_direct(plug, false));
if (rq_list_empty(plug->mq_list))
return;