* [PATCH] blk-mq: restore shared-tag flag after hctx reallocation
@ 2026-10-20 17:44 Nirmoy Das
0 siblings, 0 replies; only message in thread
From: Nirmoy Das @ 2026-10-20 17:44 UTC (permalink / raw)
To: axboe
Cc: lev, kbusch, tom.leiming, yukuai, linux-block, linux-nvme,
regressions, linux-kernel, Nirmoy Das, stable
__blk_mq_update_nr_hw_queues() reallocates the hctxs of queues already
on set->tag_list, so blk_mq_add_queue_tag_set() never sets
BLK_MQ_F_TAG_QUEUE_SHARED on them again. A new hctx starts without the
bit and a reused hctx keeps whatever it had when it was parked. An
NVMe/TCP controller reset goes through this path.
With the bit clear and an I/O scheduler, blk_mq_mark_tag_wait() sets
SCHED_RESTART without adding a tag waiter and relies on a completion on
the same hctx to run the queue again. If other queues on the set hold
all the driver tags, this hctx has nothing in flight. Once its
submitters block on scheduler tags, nothing runs it again and I/O
hangs.
Reapply the tag set's shared state after reallocating the hctxs, while
the queues are still frozen.
Reproduced on v7.3 in an arm64 QEMU/KVM guest with a loopback NVMe/TCP
target, four namespaces and mq-deadline. After one controller reset all
four namespaces lost TAG_QUEUE_SHARED and fio stalled. With this change
the bit survives five resets, and fio completes after a reset.
Fixes: 868f2f0b7206 ("blk-mq: dynamic h/w context count")
Reported-by: Lev <lev@zadarastorage.com>
Closes: https://lore.kernel.org/all/00cb01dd3099$c82b66c0$58823440$@zadarastorage.com/
Cc: stable@vger.kernel.org
Assisted-by: LLM Specula
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
---
block/blk-mq.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 00b75eb95dd943a..ec3a7e5300d0e31 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -5188,6 +5188,7 @@ static void __blk_mq_update_nr_hw_queues(struct blk_mq_tag_set *set,
set->nr_hw_queues = prev_nr_hw_queues;
goto fallback;
}
+ queue_set_hctx_shared(q, set->flags & BLK_MQ_F_TAG_QUEUE_SHARED);
blk_mq_map_swqueue(q);
}
switch_back:
--
2.43.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-20 17:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-20 17:44 [PATCH] blk-mq: restore shared-tag flag after hctx reallocation Nirmoy Das
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®