Author: huhai <huhai@xxxxxxxxxx> Date: Fri May 18 17:09:56 2018 +0800 blk-mq: make sure that correct hctx->dispatch_from is set When the number of hardware queues is changed, the drivers will call blk_mq_update_nr_hw_queues() to remap hardware queues, and then the ctx mapped on hctx will also change, but the current code forgets to make sure that correct hctx->dispatch_from is set, and hctx->dispatch_from may point to a ctx that does not belong to the current hctx. Signed-off-by: huhai <huhai@xxxxxxxxxx> diff --git a/block/blk-mq.c b/block/blk-mq.c index 2545081..55d8a3d 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2214,6 +2214,8 @@ static void blk_mq_map_swqueue(struct request_queue *q) hctx->tags = set->tags[i]; WARN_ON(!hctx->tags); + hctx->dispatch_from = NULL; + /* * Set the map size to the number of mapped software queues. * This is more accurate and more efficient than looping