From: Max Gurtovoy <mgurtovoy@nvidia.com>
To: hare@kernel.org, Christoph Hellwig <hch@lst.de>
Cc: Keith Busch <kbusch@kernel.org>, Sagi Grimberg <sagi@grimberg.me>,
linux-nvme@lists.infradead.org, Hannes Reinecke <hare@suse.de>
Subject: Re: [PATCHv2] nvme-tcp: Do not terminate i/o commands during RESETTING
Date: Sun, 14 Jan 2024 04:53:29 +0200 [thread overview]
Message-ID: <8292c439-4ac1-4ccb-9c18-71d55fbc57e2@nvidia.com> (raw)
In-Reply-To: <20240112100907.80765-1-hare@kernel.org>
Hi Hannes,
On 12/01/2024 12:09, hare@kernel.org wrote:
> From: Hannes Reinecke <hare@suse.de>
>
> Terminating commands from the timeout handler might lead
> to a data corruption as the timeout might trigger before
> KATO expired.
Can you please explain the data corruption and how this patch is fixing it ?
> When several commands have been sent in a batch and
> the command timeouts trigger just after the keep-alive
> command has been sent then the first command will trigger
> the error recovery. But all other commands will timeout
> directly afterwards and will hit the timeout handler
> before the err_work workqueue handler has started.
> This results in these commands being aborted and
> immediately retried without waiting for KATO.
> So return BLK_EH_RESET_TIMER for I/O commands when
> the controller is in 'RESETTING' or 'DELETING'
> state to ensure that the commands will
> be retried only after the KATO interval.
I'm not sure I understand how does KATO and reconnect_delay are related ?
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
> drivers/nvme/host/tcp.c | 22 ++++++++++++++++------
> 1 file changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index 08805f027810..9dcb2d3b123c 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -2431,17 +2431,27 @@ static enum blk_eh_timer_return nvme_tcp_timeout(struct request *rq)
> struct nvme_tcp_cmd_pdu *pdu = nvme_tcp_req_cmd_pdu(req);
> u8 opc = pdu->cmd.common.opcode, fctype = pdu->cmd.fabrics.fctype;
> int qid = nvme_tcp_queue_id(req->queue);
> + enum nvme_ctrl_state state = nvme_ctrl_state(ctrl);
>
> dev_warn(ctrl->device,
> - "queue %d: timeout cid %#x type %d opcode %#x (%s)\n",
> + "queue %d: timeout cid %#x type %d opcode %#x (%s) state %d\n",
> nvme_tcp_queue_id(req->queue), nvme_cid(rq), pdu->hdr.type,
> - opc, nvme_opcode_str(qid, opc, fctype));
> + opc, nvme_opcode_str(qid, opc, fctype), state);
> +
> + /*
> + * If the controller is in state RESETTING or DELETING all
> + * inflight commands will be terminated soon which in turn
> + * may failover to a different path.
> + */
> + if ((state == NVME_CTRL_RESETTING ||
> + state == NVME_CTRL_DELETING) && qid > 0)
> + return BLK_EH_RESET_TIMER;
>
> - if (nvme_ctrl_state(ctrl) != NVME_CTRL_LIVE) {
> + if (state != NVME_CTRL_LIVE) {
> /*
> - * If we are resetting, connecting or deleting we should
> - * complete immediately because we may block controller
> - * teardown or setup sequence
> + * If the controller is not live we should complete
> + * immediately because we may block controller teardown
> + * or setup sequence
> * - ctrl disable/shutdown fabrics requests
> * - connect requests
> * - initialization admin requests
next prev parent reply other threads:[~2024-01-14 2:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-12 10:09 [PATCHv2] nvme-tcp: Do not terminate i/o commands during RESETTING hare
2024-01-14 2:53 ` Max Gurtovoy [this message]
2024-01-15 6:22 ` Hannes Reinecke
2024-01-15 12:36 ` Sagi Grimberg
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=8292c439-4ac1-4ccb-9c18-71d55fbc57e2@nvidia.com \
--to=mgurtovoy@nvidia.com \
--cc=hare@kernel.org \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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