Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: maxg@mellanox.com (Max Gurtovoy)
Subject: [PATCH 2/3] nvme-rdma: use NVME_CTRL_CONNECTING state to mark init process
Date: Wed, 31 Jan 2018 18:31:25 +0200	[thread overview]
Message-ID: <1517416286-31109-3-git-send-email-maxg@mellanox.com> (raw)
In-Reply-To: <1517416286-31109-1-git-send-email-maxg@mellanox.com>

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 at mellanox.com>
---
 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 c1a9706..1d7e304 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 219c6a0..d86aee7 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -1930,6 +1930,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;
-- 
1.8.3.1

  parent reply	other threads:[~2018-01-31 16:31 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-31 16:31 [PATCH v3 0/3] Fix host side state machine Max Gurtovoy
2018-01-31 16:31 ` [PATCH 1/3] nvme: rename NVME_CTRL_RECONNECTING state to NVME_CTRL_CONNECTING Max Gurtovoy
2018-01-31 17:10   ` James Smart
2018-02-08 15:28   ` Sagi Grimberg
2018-02-08 16:19     ` Sagi Grimberg
2018-02-13 10:19       ` Max Gurtovoy
2018-02-13 10:46         ` Sagi Grimberg
2018-02-13 18:01           ` Max Gurtovoy
2018-02-13 23:55           ` Max Gurtovoy
2018-02-14 13:40             ` Sagi Grimberg
2018-02-14 14:20               ` Max Gurtovoy
2018-02-15 18:09                 ` Max Gurtovoy
2018-01-31 16:31 ` Max Gurtovoy [this message]
2018-01-31 17:10   ` [PATCH 2/3] nvme-rdma: use NVME_CTRL_CONNECTING state to mark init process James Smart
2018-01-31 16:31 ` [PATCH 3/3] nvme: delete NVME_CTRL_LIVE --> NVME_CTRL_CONNECTING transition Max Gurtovoy
2018-01-31 17:11   ` James Smart
2018-02-05 14:46 ` [PATCH v3 0/3] Fix host side state machine Sagi Grimberg
2018-02-06 15:01   ` Max Gurtovoy
2018-02-08 16:01 ` Keith Busch

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=1517416286-31109-3-git-send-email-maxg@mellanox.com \
    --to=maxg@mellanox.com \
    /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