public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCHv3] nvme-pci: fix timeout request state check
@ 2023-01-18 16:44 Keith Busch
  2023-01-19  7:30 ` Christoph Hellwig
  2023-01-23  9:45 ` Sagi Grimberg
  0 siblings, 2 replies; 3+ messages in thread
From: Keith Busch @ 2023-01-18 16:44 UTC (permalink / raw)
  To: linux-nvme, hch, sagi; +Cc: axboe, Keith Busch

From: Keith Busch <kbusch@kernel.org>

Polling the completion can progress the request state to IDLE, either
inline with the completion, or through softirq. Either way, the state
may not be COMPLETED, so don't check for that. We only care if the state
isn't IN_FLIGHT.

This is fixing an issue where the driver aborts an IO that we just
completed. Seeing the "aborting" message instead of "polled" is very
misleading as to where the timeout problem resides.

Fixes: bf392a5dc02a9b ("nvme-pci: Remove tag from process cq")
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
v2->v3: changed state check to explicitly look for not IN_FLIGHT

 drivers/nvme/host/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index a2553b7d9bb8e..1ff8843bc4b36 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -1362,7 +1362,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req)
 	else
 		nvme_poll_irqdisable(nvmeq);
 
-	if (blk_mq_request_completed(req)) {
+	if (blk_mq_rq_state(req) != MQ_RQ_IN_FLIGHT) {
 		dev_warn(dev->ctrl.device,
 			 "I/O %d QID %d timeout, completion polled\n",
 			 req->tag, nvmeq->qid);
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCHv3] nvme-pci: fix timeout request state check
  2023-01-18 16:44 [PATCHv3] nvme-pci: fix timeout request state check Keith Busch
@ 2023-01-19  7:30 ` Christoph Hellwig
  2023-01-23  9:45 ` Sagi Grimberg
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2023-01-19  7:30 UTC (permalink / raw)
  To: Keith Busch; +Cc: linux-nvme, hch, sagi, axboe, Keith Busch

Thanks,

applied to nvme-6.2.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCHv3] nvme-pci: fix timeout request state check
  2023-01-18 16:44 [PATCHv3] nvme-pci: fix timeout request state check Keith Busch
  2023-01-19  7:30 ` Christoph Hellwig
@ 2023-01-23  9:45 ` Sagi Grimberg
  1 sibling, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2023-01-23  9:45 UTC (permalink / raw)
  To: Keith Busch, linux-nvme, hch; +Cc: axboe, Keith Busch


> From: Keith Busch <kbusch@kernel.org>
> 
> Polling the completion can progress the request state to IDLE, either
> inline with the completion, or through softirq. Either way, the state
> may not be COMPLETED, so don't check for that. We only care if the state
> isn't IN_FLIGHT.
> 
> This is fixing an issue where the driver aborts an IO that we just
> completed. Seeing the "aborting" message instead of "polled" is very
> misleading as to where the timeout problem resides.
> 
> Fixes: bf392a5dc02a9b ("nvme-pci: Remove tag from process cq")
> Signed-off-by: Keith Busch <kbusch@kernel.org>
> ---
> v2->v3: changed state check to explicitly look for not IN_FLIGHT
> 
>   drivers/nvme/host/pci.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index a2553b7d9bb8e..1ff8843bc4b36 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -1362,7 +1362,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req)
>   	else
>   		nvme_poll_irqdisable(nvmeq);
>   
> -	if (blk_mq_request_completed(req)) {
> +	if (blk_mq_rq_state(req) != MQ_RQ_IN_FLIGHT) {

I think that this change also applies to nvmf_complete_timed_out_request
no?


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-23  9:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-18 16:44 [PATCHv3] nvme-pci: fix timeout request state check Keith Busch
2023-01-19  7:30 ` Christoph Hellwig
2023-01-23  9:45 ` Sagi Grimberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox