aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Gurtovoy <maxg@mellanox.com>2018-01-31 11:31:25 -0500
committerSagi Grimberg <sagi@grimberg.me>2018-02-08 11:35:53 -0500
commitb754a32c66772e6510acd92237aadd4cf227ae39 (patch)
treecf770175ac62bb3dc87a57d8e061d9e13cb1c268
parentad6a0a52e6de3d1161b7999c7903db906ba4cf79 (diff)
nvme-rdma: use NVME_CTRL_CONNECTING state to mark init process
In order to avoid concurrent error recovery during initialization process (allowed by the NVME_CTRL_NEW --> NVME_CTRL_RESETTING transition) we must mark the ctrl as CONNECTING before initial connection establisment. Signed-off-by: Max Gurtovoy <maxg@mellanox.com> Reviewed-by: James Smart <james.smart@broadcom.com> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
-rw-r--r--drivers/nvme/host/core.c1
-rw-r--r--drivers/nvme/host/rdma.c3
2 files changed, 4 insertions, 0 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 1033de4136e0..86dca2919e19 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -296,6 +296,7 @@ bool nvme_change_ctrl_state(struct nvme_ctrl *ctrl,
296 break; 296 break;
297 case NVME_CTRL_CONNECTING: 297 case NVME_CTRL_CONNECTING:
298 switch (old_state) { 298 switch (old_state) {
299 case NVME_CTRL_NEW:
299 case NVME_CTRL_LIVE: 300 case NVME_CTRL_LIVE:
300 case NVME_CTRL_RESETTING: 301 case NVME_CTRL_RESETTING:
301 changed = true; 302 changed = true;
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 050eaa24cc7d..5e2cc4f0d207 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -1942,6 +1942,9 @@ static struct nvme_ctrl *nvme_rdma_create_ctrl(struct device *dev,
1942 if (!ctrl->queues) 1942 if (!ctrl->queues)
1943 goto out_uninit_ctrl; 1943 goto out_uninit_ctrl;
1944 1944
1945 changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING);
1946 WARN_ON_ONCE(!changed);
1947
1945 ret = nvme_rdma_configure_admin_queue(ctrl, true); 1948 ret = nvme_rdma_configure_admin_queue(ctrl, true);
1946 if (ret) 1949 if (ret)
1947 goto out_kfree_queues; 1950 goto out_kfree_queues;