Skip to content

Commit 166e31d

Browse files
committed
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>
1 parent bbdaa8c commit 166e31d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/nvme/host/pci.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1627,7 +1627,8 @@ static int nvme_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob)
16271627
struct nvme_queue *nvmeq = hctx->driver_data;
16281628
bool found;
16291629

1630-
if (!nvme_cqe_pending(nvmeq))
1630+
if (!test_bit(NVMEQ_POLLED, &nvmeq->flags) ||
1631+
!nvme_cqe_pending(nvmeq))
16311632
return 0;
16321633

16331634
spin_lock(&nvmeq->cq_poll_lock);

0 commit comments

Comments
 (0)