If we don't have poll queue, its mapping should share default type's, instead of setting up one new mapping via blk_mq_map_queues(). blk_mq_map_swqueue() is actually fragile to deal with shared mapping, then one same ctx can be mapped to two hctxes with same queue type, this way may cause IO hang easily. Cc: Jeff Moyer <jmoyer@xxxxxxxxxx> Cc: Mike Snitzer <snitzer@xxxxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> --- drivers/nvme/host/pci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index fb9d8270f32c..95bd68be2078 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -505,10 +505,11 @@ static int nvme_pci_map_queues(struct blk_mq_tag_set *set) /* * The poll queue(s) doesn't have an IRQ (and hence IRQ - * affinity), so use the regular blk-mq cpu mapping + * affinity), so use the regular blk-mq cpu mapping if + * poll queue(s) don't share mapping with TYPE_DEFAULT. */ map->queue_offset = qoff; - if (i != HCTX_TYPE_POLL) + if (i != HCTX_TYPE_POLL || !qoff) blk_mq_pci_map_queues(map, to_pci_dev(dev->dev), offset); else blk_mq_map_queues(map); -- 2.9.5