From a53a96768b9ef453a8b6568473ae9c598c8f10ee Mon Sep 17 00:00:00 2001 From: Jeffle Xu Date: Thu, 3 Dec 2020 17:34:54 +0800 Subject: [PATCH 2440/2944] alinux: dm: apply more restrictive constraints for iopoll fix #29533985 Currently nvme supports iopoll even when nvme.poll_queues is 0, in which case q->tag_set->map[HCTX_TYPE_POLL].nr_queues is 0. The current implementation of device-mapper iopoll depends on queue_for_each_poll_hw_ctx(), which will iterate all hw queues in polling mode of all underlying devices. When map[HCTX_TYPE_POLL].nr_queues of nvme device is 0, dm_io_poll() will get stuck in dead loop if @spin is true. Fix this issue by applying more restrictive constraints when checking if dm device supports iopoll. Now map[HCTX_TYPE_POLL].nr_queues of underlying devices should be non-zero if it's mq device type. Signed-off-by: Jeffle Xu Acked-by: Joseph Qi --- drivers/md/dm-table.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index a3adb3a..df544b1 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -1937,7 +1937,8 @@ static int device_supports_poll(struct dm_target *ti, struct dm_dev *dev, { struct request_queue *q = bdev_get_queue(dev->bdev); - return q && test_bit(QUEUE_FLAG_POLL, &q->queue_flags); + return q && test_bit(QUEUE_FLAG_POLL, &q->queue_flags) && + (!q->mq_ops || q->tag_set->map[HCTX_TYPE_POLL].nr_queues); } static bool dm_table_supports_poll(struct dm_table *t) -- 1.8.3.1