]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
nvme-pci: ensure we're polling a polled queue
authorKeith Busch <kbusch@kernel.org>
Tue, 10 Feb 2026 17:26:54 +0000 (09:26 -0800)
committerKeith Busch <kbusch@kernel.org>
Fri, 13 Feb 2026 14:47:24 +0000 (06:47 -0800)
A user can change the polled queue count at run time. There's a brief
window during a reset where a hipri task may try to poll that queue
before the block layer has updated the queue maps, which would race with
the now interrupt driven queue and may cause double completions.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/pci.c

index c0f2104326ab422f5bc10341e74ac4ba23502cac..4ee4d7ead5a920b75ae2d51b86263e63a475e9f8 100644 (file)
@@ -1627,7 +1627,8 @@ static int nvme_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob)
        struct nvme_queue *nvmeq = hctx->driver_data;
        bool found;
 
-       if (!nvme_cqe_pending(nvmeq))
+       if (!test_bit(NVMEQ_POLLED, &nvmeq->flags) ||
+           !nvme_cqe_pending(nvmeq))
                return 0;
 
        spin_lock(&nvmeq->cq_poll_lock);