From: Ming Lei Date: Mon, 17 Dec 2018 17:28:56 +0000 (+0800) Subject: blk-mq: skip zero-queue maps in blk_mq_map_swqueue X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=e5edd5f298fafda28284bafb8371e6f0b7681035;p=openwrt%2Fstaging%2Fblogic.git blk-mq: skip zero-queue maps in blk_mq_map_swqueue From 7e849dd9cf37 ("nvme-pci: don't share queue maps"), the mapping table won't be initialized actually if map->nr_queues is zero, so we can't use blk_mq_map_queue_type() to retrieve hctx any more. This way still may cause broken mapping, fix it by skipping zero-queues maps in blk_mq_map_swqueue(). Cc: Jeff Moyer Cc: Mike Snitzer Reviewed-by: Christoph Hellwig Signed-off-by: Ming Lei Signed-off-by: Jens Axboe --- diff --git a/block/blk-mq.c b/block/blk-mq.c index 9c1c1544bac3..6847f014606b 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2438,6 +2438,9 @@ static void blk_mq_map_swqueue(struct request_queue *q) ctx = per_cpu_ptr(q->queue_ctx, i); for (j = 0; j < set->nr_maps; j++) { + if (!set->map[j].nr_queues) + continue; + hctx = blk_mq_map_queue_type(q, j, i); /*