All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme-tcp: fix bogus request completion when failing to send AER
@ 2022-02-06 22:40 Sagi Grimberg
  2022-02-07  9:23 ` Hannes Reinecke
  2022-02-09  7:51 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: Sagi Grimberg @ 2022-02-06 22:40 UTC (permalink / raw)
  To: linux-nvme, Christoph Hellwig, Keith Busch; +Cc: Anton Eidelman

AER is not backed by a real request, hence we should not incorrectly
assume that when failing to send a nvme command, it is a normal request
but rather check if this is an aer and if so complete the aer (similar
to the normal completion path).

Cc: stable@vger.kernel.org
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 drivers/nvme/host/tcp.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 01e24b5703db..1096a0b0a268 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -913,7 +913,15 @@ static inline void nvme_tcp_done_send_req(struct nvme_tcp_queue *queue)
 
 static void nvme_tcp_fail_request(struct nvme_tcp_request *req)
 {
-	nvme_tcp_end_request(blk_mq_rq_from_pdu(req), NVME_SC_HOST_PATH_ERROR);
+	if (nvme_tcp_async_req(req)) {
+		union nvme_result res = {};
+
+		nvme_complete_async_event(&req->queue->ctrl->ctrl,
+			NVME_SC_HOST_PATH_ERROR, &res);
+	} else {
+		nvme_tcp_end_request(blk_mq_rq_from_pdu(req),
+				NVME_SC_HOST_PATH_ERROR);
+	}
 }
 
 static int nvme_tcp_try_send_data(struct nvme_tcp_request *req)
-- 
2.30.2



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

* Re: [PATCH] nvme-tcp: fix bogus request completion when failing to send AER
  2022-02-06 22:40 [PATCH] nvme-tcp: fix bogus request completion when failing to send AER Sagi Grimberg
@ 2022-02-07  9:23 ` Hannes Reinecke
  2022-02-09  7:51 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Hannes Reinecke @ 2022-02-07  9:23 UTC (permalink / raw)
  To: Sagi Grimberg, linux-nvme, Christoph Hellwig, Keith Busch; +Cc: Anton Eidelman

On 2/6/22 23:40, Sagi Grimberg wrote:
> AER is not backed by a real request, hence we should not incorrectly
> assume that when failing to send a nvme command, it is a normal request
> but rather check if this is an aer and if so complete the aer (similar
> to the normal completion path).
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
> ---
>   drivers/nvme/host/tcp.c | 10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index 01e24b5703db..1096a0b0a268 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -913,7 +913,15 @@ static inline void nvme_tcp_done_send_req(struct nvme_tcp_queue *queue)
>   
>   static void nvme_tcp_fail_request(struct nvme_tcp_request *req)
>   {
> -	nvme_tcp_end_request(blk_mq_rq_from_pdu(req), NVME_SC_HOST_PATH_ERROR);
> +	if (nvme_tcp_async_req(req)) {
> +		union nvme_result res = {};
> +
> +		nvme_complete_async_event(&req->queue->ctrl->ctrl,
> +			NVME_SC_HOST_PATH_ERROR, &res);
> +	} else {
> +		nvme_tcp_end_request(blk_mq_rq_from_pdu(req),
> +				NVME_SC_HOST_PATH_ERROR);
> +	}
>   }
>   
>   static int nvme_tcp_try_send_data(struct nvme_tcp_request *req)
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		           Kernel Storage Architect
hare@suse.de			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer


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

* Re: [PATCH] nvme-tcp: fix bogus request completion when failing to send AER
  2022-02-06 22:40 [PATCH] nvme-tcp: fix bogus request completion when failing to send AER Sagi Grimberg
  2022-02-07  9:23 ` Hannes Reinecke
@ 2022-02-09  7:51 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2022-02-09  7:51 UTC (permalink / raw)
  To: Sagi Grimberg; +Cc: linux-nvme, Christoph Hellwig, Keith Busch, Anton Eidelman

Thanks,

applied to nvme-5.17.


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

end of thread, other threads:[~2022-02-09  7:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-06 22:40 [PATCH] nvme-tcp: fix bogus request completion when failing to send AER Sagi Grimberg
2022-02-07  9:23 ` Hannes Reinecke
2022-02-09  7:51 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.