nvme: short-circuit connection retries
v2 cover nvme: short-circuit connection retries
Hi all,
here are two patches updating nvme-tcp and nvme-rdma transport to modifications we've already have in nvme-fc with commit f25f8ef70ce2 ("nvme-fc: short-circuit reconnect retries"). Gist is to short-circuit reconnection retries if we get a status back with the DNR bit set, in which case we shouldn't retry the connection attempt.
As usual, comments and reviews are welcome.
Changes to the original version:
- Rework with suggestions from Sagi
Hannes Reinecke (2):
nvme-tcp: short-circuit connect retries
nvme-rdma: short-circuit connect retries
drivers/nvme/host/rdma.c | 20 +++++++++++++++++--- drivers/nvme/host/tcp.c | 21 ++++++++++++++++++--- 2 files changed, 35 insertions(+), 6 deletions(-)
Signature · 1 line
2.29.2
PATCH v2 1/2 nvme-tcp: short-circuit connect retries
When a reconnect attempt fails with a non-retryable status (eg when the subsystem has been unprovisioned) there hardly is any reason to retry the reconnect attempt.
So check the actual error status from nvme_tcp_setup_ctrl(), and call nvme_delete_ctrl() instead of calling nvme_tcp_reconnect_or_remove() if the DNR bit is set.
--- drivers/nvme/host/tcp.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
drivers/nvme/host/tcp.c +18 -3
@@ -2157,10 +2157,12 @@ static void nvme_tcp_reconnect_ctrl_work(struct work_struct *work)struct nvme_tcp_ctrl *tcp_ctrl =container_of (to_delayed_work (work), struct nvme_tcp_ctrl, connect_work);struct nvme_ctrl *ctrl = &tcp_ctrl->ctrl; +int ret; ++ctrl->nr_reconnects; -if (nvme_tcp_setup_ctrl (ctrl, false)) + ret =nvme_tcp_setup_ctrl (ctrl, false); +if (ret) goto requeue; dev_info(ctrl->device, "Successfully reconnected (%d attempt)\n",
@@ -2173,6 +2175,12 @@ static void nvme_tcp_reconnect_ctrl_work(struct work_struct *work) requeue:dev_info (ctrl->device,"Failed reconnect attempt %d\n" , ctrl->nr_reconnects); +if (ret >0 && (ret &NVME_SC_DNR )) { +dev_info (ctrl->device, +"Removing ctrl...\n" ); +nvme_delete_ctrl (ctrl); +return ; + }nvme_tcp_reconnect_or_remove (ctrl); }
@@ -2224,6 +2232,7 @@ static void nvme_reset_ctrl_work(struct work_struct *work) {struct nvme_ctrl *ctrl = container_of(work, struct nvme_ctrl, reset_work); +int ret;nvme_stop_ctrl (ctrl);nvme_tcp_teardown_ctrl (ctrl, false);
@@ -2235,9 +2244,15 @@ static void nvme_reset_ctrl_work(struct work_struct *work)return ; } -if (nvme_tcp_setup_ctrl (ctrl, false)) + ret =nvme_tcp_setup_ctrl (ctrl, false); +if (ret) { +if (ret >0 && (ret &NVME_SC_DNR )) { +dev_info (ctrl->device,"Removing ctrl...\n" ); +nvme_delete_ctrl (ctrl); +return ; + } goto out_fail; - + }return ; out_fail:
Signature · 1 line
2.29.2
PATCH v2 2/2 nvme-rdma: short-circuit connect retries
In reply to Hannes ReineckeWhen a reconnect attempt fails with a non-retryable status
(eg when the subsystem has been unprovisioned) there hardly
is any reason to retry the reconnect attempt.
So check the actual error status from nvme_rdma_setup_ctrl(), and call nvme_delete_ctrl() instead of calling nvme_rdma_reconnect_or_remove() if the DNR bit is set.
--- drivers/nvme/host/rdma.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/nvme/host/rdma.c +17 -3
@@ -1170,10 +1170,12 @@ static void nvme_rdma_reconnect_ctrl_work(struct work_struct *work) {struct nvme_rdma_ctrl *ctrl =container_of (to_delayed_work (work), struct nvme_rdma_ctrl, reconnect_work); +int ret; ++ctrl->ctrl.nr_reconnects; -if (nvme_rdma_setup_ctrl (ctrl, false)) + ret =nvme_rdma_setup_ctrl (ctrl, false); +if (ret) goto requeue; dev_info(ctrl->ctrl.device, "Successfully reconnected (%d attempts)\n",
@@ -1186,6 +1188,11 @@ static void nvme_rdma_reconnect_ctrl_work(struct work_struct *work) requeue:dev_info (ctrl->ctrl.device,"Failed reconnect attempt %d\n" , ctrl->ctrl.nr_reconnects); +if (ret >0 && (ret &NVME_SC_DNR )) { +dev_info (ctrl->ctrl.device,"Removing ctrl...\n" ); +nvme_delete_ctrl (&ctrl->ctrl); +return ; + }nvme_rdma_reconnect_or_remove (ctrl); }
@@ -2271,6 +2278,7 @@ static void nvme_rdma_reset_ctrl_work(struct work_struct *work) {struct nvme_rdma_ctrl *ctrl = container_of(work, struct nvme_rdma_ctrl, ctrl.reset_work); +int ret;nvme_stop_ctrl (&ctrl->ctrl);nvme_rdma_shutdown_ctrl (ctrl, false);
@@ -2281,9 +2289,15 @@ static void nvme_rdma_reset_ctrl_work(struct work_struct *work)return ; } -if (nvme_rdma_setup_ctrl (ctrl, false)) + ret =nvme_rdma_setup_ctrl (ctrl, false); +if (ret) { +if (ret >0 && (ret &NVME_SC_DNR )) { +dev_info (ctrl->ctrl.device,"Removing ctrl...\n" ); +nvme_delete_ctrl (&ctrl->ctrl); +return ; + } goto out_fail; - + }return ; out_fail:
Signature · 1 line
2.29.2