blk-mq: restore shared-tag flag after hctx reallocation
Subsystems (4)
PATCH 1/1 blk-mq: restore shared-tag flag after hctx reallocation
__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.
--- block/blk-mq.c | 1 + 1 file changed, 1 insertion(+)
block/blk-mq.c +1 -0
@@ -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:
Signature · 1 line
2.43.0