Skip to content

Commit 454bb67

Browse files
YuKuai-huaweiaxboe
authored andcommitted
blk-mq: clear active_queues before clearing BLK_MQ_F_TAG_QUEUE_SHARED
We run a test that delete and recover devcies frequently(two devices on the same host), and we found that 'active_queues' is super big after a period of time. If device a and device b share a tag set, and a is deleted, then blk_mq_exit_queue() will clear BLK_MQ_F_TAG_QUEUE_SHARED because there is only one queue that are using the tag set. However, if b is still active, the active_queues of b might never be cleared even if b is deleted. Thus clear active_queues before BLK_MQ_F_TAG_QUEUE_SHARED is cleared. Signed-off-by: Yu Kuai <[email protected]> Reviewed-by: Ming Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 0f78399 commit 454bb67

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

block/blk-mq.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2994,10 +2994,12 @@ static void queue_set_hctx_shared(struct request_queue *q, bool shared)
29942994
int i;
29952995

29962996
queue_for_each_hw_ctx(q, hctx, i) {
2997-
if (shared)
2997+
if (shared) {
29982998
hctx->flags |= BLK_MQ_F_TAG_QUEUE_SHARED;
2999-
else
2999+
} else {
3000+
blk_mq_tag_idle(hctx);
30003001
hctx->flags &= ~BLK_MQ_F_TAG_QUEUE_SHARED;
3002+
}
30013003
}
30023004
}
30033005

0 commit comments

Comments
 (0)