summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Busch <kbusch@kernel.org>2026-02-10 20:26:54 +0300
committerKeith Busch <kbusch@kernel.org>2026-02-13 17:47:24 +0300
commit166e31d7dbf6aa44829b98aa446bda5c9580f12a (patch)
treeec17f537f0eeb16edd8b9adf1432c264f90718b4
parentbbdaa8c17cae18b977f4509911d7a390aa8a6597 (diff)
downloadlinux-166e31d7dbf6aa44829b98aa446bda5c9580f12a.tar.xz
nvme-pci: ensure we're polling a polled queue
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>
-rw-r--r--drivers/nvme/host/pci.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index c0f2104326ab..4ee4d7ead5a9 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -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);