Skip to content

Commit 630ef62

Browse files
bvanasscheaxboe
authored andcommitted
blk-mq: Swap two calls in blk_mq_exit_queue()
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 <hch@infradead.org> Cc: Ming Lei <ming.lei@redhat.com> Cc: Hannes Reinecke <hare@suse.com> Fixes: 0d2602c ("blk-mq: improve support for shared tags maps") Signed-off-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20210513171529.7977-1-bvanassche@acm.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 03f26d8 commit 630ef62

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

block/blk-mq.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3286,10 +3286,12 @@ EXPORT_SYMBOL(blk_mq_init_allocated_queue);
32863286
/* tags can _not_ be used after returning from blk_mq_exit_queue */
32873287
void blk_mq_exit_queue(struct request_queue *q)
32883288
{
3289-
struct blk_mq_tag_set *set = q->tag_set;
3289+
struct blk_mq_tag_set *set = q->tag_set;
32903290

3291-
blk_mq_del_queue_tag_set(q);
3291+
/* Checks hctx->flags & BLK_MQ_F_TAG_QUEUE_SHARED. */
32923292
blk_mq_exit_hw_queues(q, set, set->nr_hw_queues);
3293+
/* May clear BLK_MQ_F_TAG_QUEUE_SHARED in hctx->flags. */
3294+
blk_mq_del_queue_tag_set(q);
32933295
}
32943296

32953297
static int __blk_mq_alloc_rq_maps(struct blk_mq_tag_set *set)

0 commit comments

Comments
 (0)