From: Keith Busch <kbusch@meta.com>
To: <linux-nvme@lists.infradead.org>
Cc: <hch@lst.de>, <joshi.k@samsung.com>, Keith Busch <kbusch@kernel.org>
Subject: [PATCHv2 1/3] nvme-pci: ensure we're polling a polled queue
Date: Thu, 12 Feb 2026 08:47:31 -0800 [thread overview]
Message-ID: <20260212164733.3006071-2-kbusch@meta.com> (raw)
In-Reply-To: <20260212164733.3006071-1-kbusch@meta.com>
From: Keith Busch <kbusch@kernel.org>
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>
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
drivers/nvme/host/pci.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index c0f2104326ab4..4ee4d7ead5a92 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);
--
2.47.3
next prev parent reply other threads:[~2026-02-12 16:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 16:47 [PATCHv2 0/3] nvme fix handling for user changed module params Keith Busch
2026-02-12 16:47 ` Keith Busch [this message]
2026-02-13 10:23 ` [PATCHv2 1/3] nvme-pci: ensure we're polling a polled queue Kanchan Joshi
2026-02-12 16:47 ` [PATCHv2 2/3] nvme-pci: cap queue creation to used queues Keith Busch
2026-02-13 6:25 ` Christoph Hellwig
2026-02-12 16:47 ` [PATCHv2 3/3] nvme-pci: do not try to add queue maps at runtime Keith Busch
2026-02-13 6:25 ` Christoph Hellwig
2026-02-13 10:35 ` Kanchan Joshi
2026-02-13 16:14 ` Keith Busch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260212164733.3006071-2-kbusch@meta.com \
--to=kbusch@meta.com \
--cc=hch@lst.de \
--cc=joshi.k@samsung.com \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox