linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nvme/tcp: fix bug on double requeue when send fails
@ 2020-02-10 18:37 Anton Eidelman
  2020-02-10 18:41 ` Sagi Grimberg
  2020-02-11 20:27 ` Keith Busch
  0 siblings, 2 replies; 3+ messages in thread
From: Anton Eidelman @ 2020-02-10 18:37 UTC (permalink / raw)
  To: linux-nvme, hch, keith.busch, sagi, hare; +Cc: Anton Eidelman

When nvme_tcp_io_work() fails to send to socket due to
connection close/reset, error_recovery work is triggered
from nvme_tcp_state_change() socket callback.
This cancels all the active requests in the tagset,
which requeues them.

The failed request, however, was ended and thus requeued
individually as well unless send returned -EPIPE.
Another return code to be treated the same way is -ECONNRESET.

Double requeue caused BUG_ON(blk_queued_rq(rq))
in blk_mq_requeue_request() from either the individual requeue
of the failed request or the bulk requeue from
blk_mq_tagset_busy_iter(, nvme_cancel_request, );

Signed-off-by: Anton Eidelman <anton@lightbitslabs.com>
---
 drivers/nvme/host/tcp.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 6d43b23a0fc8..f8fa5c5b79f1 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -1054,7 +1054,12 @@ static void nvme_tcp_io_work(struct work_struct *w)
 		} else if (unlikely(result < 0)) {
 			dev_err(queue->ctrl->ctrl.device,
 				"failed to send request %d\n", result);
-			if (result != -EPIPE)
+
+			/*
+			 * Fail the request unless peer closed the connection,
+			 * in which case error recovery flow will complete all.
+			 */
+			if ((result != -EPIPE) && (result != -ECONNRESET))
 				nvme_tcp_fail_request(queue->request);
 			nvme_tcp_done_send_req(queue);
 			return;
-- 
2.14.1


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [PATCH] nvme/tcp: fix bug on double requeue when send fails
  2020-02-10 18:37 [PATCH] nvme/tcp: fix bug on double requeue when send fails Anton Eidelman
@ 2020-02-10 18:41 ` Sagi Grimberg
  2020-02-11 20:27 ` Keith Busch
  1 sibling, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2020-02-10 18:41 UTC (permalink / raw)
  To: Anton Eidelman, linux-nvme, hch, Keith Busch, hare

Adding updated Keith's updated email:

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

* Re: [PATCH] nvme/tcp: fix bug on double requeue when send fails
  2020-02-10 18:37 [PATCH] nvme/tcp: fix bug on double requeue when send fails Anton Eidelman
  2020-02-10 18:41 ` Sagi Grimberg
@ 2020-02-11 20:27 ` Keith Busch
  1 sibling, 0 replies; 3+ messages in thread
From: Keith Busch @ 2020-02-11 20:27 UTC (permalink / raw)
  To: Anton Eidelman; +Cc: keith.busch, hare, hch, linux-nvme, sagi

On Mon, Feb 10, 2020 at 10:37:18AM -0800, Anton Eidelman wrote:
> When nvme_tcp_io_work() fails to send to socket due to
> connection close/reset, error_recovery work is triggered
> from nvme_tcp_state_change() socket callback.
> This cancels all the active requests in the tagset,
> which requeues them.
> 
> The failed request, however, was ended and thus requeued
> individually as well unless send returned -EPIPE.
> Another return code to be treated the same way is -ECONNRESET.
> 
> Double requeue caused BUG_ON(blk_queued_rq(rq))
> in blk_mq_requeue_request() from either the individual requeue
> of the failed request or the bulk requeue from
> blk_mq_tagset_busy_iter(, nvme_cancel_request, );
> 
> Signed-off-by: Anton Eidelman <anton@lightbitslabs.com>

Thanks, applied to nvme-5.6-rc

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

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

end of thread, other threads:[~2020-02-11 20:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-10 18:37 [PATCH] nvme/tcp: fix bug on double requeue when send fails Anton Eidelman
2020-02-10 18:41 ` Sagi Grimberg
2020-02-11 20:27 ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).