]> Git Repo - J-linux.git/commitdiff
blk-mq: Swap two calls in blk_mq_exit_queue()
authorBart Van Assche <[email protected]>
Thu, 13 May 2021 17:15:29 +0000 (10:15 -0700)
committerJens Axboe <[email protected]>
Fri, 14 May 2021 14:59:31 +0000 (08:59 -0600)
If a tag set is shared across request queues (e.g. SCSI LUNs) then the
block layer core keeps track of the number of active request queues in
tags->active_queues. blk_mq_tag_busy() and blk_mq_tag_idle() update that
atomic counter if the hctx flag BLK_MQ_F_TAG_QUEUE_SHARED is set. Make
sure that blk_mq_exit_queue() calls blk_mq_tag_idle() before that flag is
cleared by blk_mq_del_queue_tag_set().

Cc: Christoph Hellwig <[email protected]>
Cc: Ming Lei <[email protected]>
Cc: Hannes Reinecke <[email protected]>
Fixes: 0d2602ca30e4 ("blk-mq: improve support for shared tags maps")
Signed-off-by: Bart Van Assche <[email protected]>
Reviewed-by: Ming Lei <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
block/blk-mq.c

index 28ef0248efba3646bb5343fb8230fa06694a2a78..c86c01bfecdbe51e67128bc952c2780c4a9eecab 100644 (file)
@@ -3286,10 +3286,12 @@ EXPORT_SYMBOL(blk_mq_init_allocated_queue);
 /* tags can _not_ be used after returning from blk_mq_exit_queue */
 void blk_mq_exit_queue(struct request_queue *q)
 {
-       struct blk_mq_tag_set   *set = q->tag_set;
+       struct blk_mq_tag_set *set = q->tag_set;
 
-       blk_mq_del_queue_tag_set(q);
+       /* Checks hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED. */
        blk_mq_exit_hw_queues(q, set, set->nr_hw_queues);
+       /* May clear BLK_MQ_F_TAG_QUEUE_SHARED in hctx->flags. */
+       blk_mq_del_queue_tag_set(q);
 }
 
 static int __blk_mq_alloc_rq_maps(struct blk_mq_tag_set *set)
This page took 0.051423 seconds and 4 git commands to generate.