[PATCH 08/19] nvme-tcp: start error recovery when a send fails
Maurizio Lombardi
mlombard at arkamax.eu
Thu Oct 29 09:17:05 PDT 2026
On Thu Oct 29, 2026 at 4:52 PM CET, Keith Busch wrote:
> From: Josef Bacik <josef at toxicpanda.com>
>
> When the target closes a connection, nvme_tcp_state_change() calls
> nvme_tcp_error_recovery(), which does nothing unless the controller is
> live. While connecting that's fine for the queue being set up, its
> Connect fails and the attempt with it. But if an already connected queue
> is closed at the end of the attempt, nothing fails, the notification is
> lost and the controller goes live on a dead socket. Every request on
> that queue then fails with "failed to send request -32" and is retried,
> forever with native multipathing, and if it's the admin queue the first
> keep-alive fails too. Nothing but a manual reset recovers it. The Linux
> target closes its connections at exactly that moment after a fatal
> error.
>
> Start error recovery when a request can't be sent, as nvme-rdma does.
>
> Fixes: 3f2304f8c6d6 ("nvme-tcp: add NVMe over TCP host driver")
> Cc: Keith Busch <kbusch at kernel.org>
> Cc: Christoph Hellwig <hch at lst.de>
> Cc: Sagi Grimberg <sagi at grimberg.me>
> Reviewed-by: Hannes Reinecke <hare at kernel.org>
> Signed-off-by: Josef Bacik <josef at toxicpanda.com>
> Signed-off-by: Jens Axboe <axboe at kernel.dk>
> Signed-off-by: Keith Busch <kbusch at kernel.org>
> ---
> drivers/nvme/host/tcp.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index bc46e5f3eaa79..9e15311e7d9cc 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -1437,6 +1437,8 @@ static int nvme_tcp_try_send(struct nvme_tcp_queue *queue)
> "failed to send request %d\n", ret);
> nvme_tcp_fail_request(queue->request);
> nvme_tcp_done_send_req(queue);
> + /* The close may have come when nobody could act on it */
> + nvme_tcp_error_recovery(&queue->ctrl->ctrl);
> }
> out:
> memalloc_noreclaim_restore(noreclaim_flag);
I remember I posted an identical patch several months ago and I
self-nacked it because it made blktests md/001 fail
https://lore.kernel.org/linux-nvme/DDNRV5MAVQCF.2SH49C0P5MKVF@bsdbackstore.eu/
You might want to check if it's still the case before merging it.
Maurizio
More information about the Linux-nvme
mailing list