When a driver stops a hardware queue with blk_mq_stop_hw_queues() and the number of hardware queues shrinks before it calls blk_mq_start_stopped_hw_queues() again, the parked hctx keeps its BLK_MQ_S_STOPPED flag: the exit path does not clear it, and blk_mq_start_stopped_hw_queues() only walks the live hctxs. A later update that reuses the parked hctx via blk_mq_alloc_and_init_hctx() inherits the flag, so blk_mq_run_hw_queue() refuses to run requests queued on it until the driver happens to stop and restart the queue again. Clear BLK_MQ_S_STOPPED in blk_mq_init_hctx() so a reused hctx starts like a freshly allocated one, matching the BLK_MQ_S_INACTIVE handling. Fixes: 2f8f1336a48b ("blk-mq: always free hctx after request queue is freed") Cc: stable@vger.kernel.org Signed-off-by: Guixin Liu --- block/blk-mq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/blk-mq.c b/block/blk-mq.c index ae12f2a52cc9..87c1ccdf66ab 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -4016,6 +4016,7 @@ static int blk_mq_init_hctx(struct request_queue *q, hctx->queue_num = hctx_idx; clear_bit(BLK_MQ_S_INACTIVE, &hctx->state); + clear_bit(BLK_MQ_S_STOPPED, &hctx->state); hctx->tags = set->tags[hctx_idx]; -- 2.43.7