nvme-rdma: use NVME_CTRL_CONNECTING state to mark init process

"Linux Kernel Mailing List" <[email protected]> Sat, 17 Feb 2018 19:17:15 +0000 (UTC)
Newsgroups gmane.linux.kernel.commits.head
Message-ID <[email protected]>
Web:        https://git.kernel.org/torvalds/c/b754a32c66772e6510acd92237aadd4cf227ae39
Commit:     b754a32c66772e6510acd92237aadd4cf227ae39
Parent:     ad6a0a52e6de3d1161b7999c7903db906ba4cf79
Refname:    refs/heads/master
Author:     Max Gurtovoy <[email protected]>
AuthorDate: Wed Jan 31 18:31:25 2018 +0200
Committer:  Sagi Grimberg <[email protected]>
CommitDate: Thu Feb 8 18:35:53 2018 +0200

    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 <[email protected]>
    Reviewed-by: James Smart <[email protected]>
    Signed-off-by: Sagi Grimberg <[email protected]>
---
 drivers/nvme/host/core.c | 1 +
 drivers/nvme/host/rdma.c | 3 +++
 2 files changed, 4 insertions(+)

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,
 		break;
 	case NVME_CTRL_CONNECTING:
 		switch (old_state) {
+		case NVME_CTRL_NEW:
 		case NVME_CTRL_LIVE:
 		case NVME_CTRL_RESETTING:
 			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,
 	if (!ctrl->queues)
 		goto out_uninit_ctrl;
 
+	changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_CONNECTING);
+	WARN_ON_ONCE(!changed);
+
 	ret = nvme_rdma_configure_admin_queue(ctrl, true);
 	if (ret)
 		goto out_kfree_queues;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html