All of lore.kernel.org
 help / color / mirror / Atom feed
From: jsmart2021@gmail.com (jsmart2021@gmail.com)
Subject: [RFC 1/7] nvme_fc: change ctlr state assignments during reset/reconnect
Date: Thu,  4 May 2017 11:07:31 -0700	[thread overview]
Message-ID: <20170504180737.5472-2-jsmart2021@gmail.com> (raw)
In-Reply-To: <20170504180737.5472-1-jsmart2021@gmail.com>

From: James Smart <jsmart2021@gmail.com>

Existing code:
Set NVME_CTRL_RESETTING upon entry from the core reset_ctrl
callback and left it set that way until reconnected.
Set NVME_CTRL_REcONNECTING after a transport detected error
and left it set that way until reconnected.

Revise the code so that NVME_CTRL_RESETTING is always set when
tearing down the association regardless of why/how, and after
the association is torn down, transition to NVME_CTRL_RECONNECTING
while it attempts to establish a new association with the target.

The RESETTING->RECONNECTING state transition is dependent upon the
patch that enables the transition.

Signed-off-by: James Smart <james.smart at broadcom.com>
---
 drivers/nvme/host/fc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 9993ff8d5656..ac7e8145e5ec 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -1759,7 +1759,7 @@ nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg)
 	if (ctrl->queue_count > 1)
 		nvme_stop_queues(&ctrl->ctrl);
 
-	if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RECONNECTING)) {
+	if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RESETTING)) {
 		dev_err(ctrl->ctrl.device,
 			"NVME-FC{%d}: error_recovery: Couldn't change state "
 			"to RECONNECTING\n", ctrl->cnum);
@@ -2628,6 +2628,13 @@ nvme_fc_reset_ctrl_work(struct work_struct *work)
 	/* will block will waiting for io to terminate */
 	nvme_fc_delete_association(ctrl);
 
+	if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RECONNECTING)) {
+		dev_err(ctrl->ctrl.device,
+			"NVME-FC{%d}: controller reset: Couldn't change "
+			"state to RECONNECTING\n", ctrl->cnum);
+		return;
+	}
+
 	ret = nvme_fc_create_association(ctrl);
 	if (ret)
 		nvme_fc_reconnect_or_delete(ctrl, ret);
-- 
2.11.0

  reply	other threads:[~2017-05-04 18:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-04 18:07 [RFC 0/7] nvme_fc: add dev_loss_tmo support jsmart2021
2017-05-04 18:07 ` jsmart2021 [this message]
2017-05-04 18:07 ` [RFC 2/7] nvme_fc: add a dev_loss_tmo field to the remoteport jsmart2021
2017-05-04 18:07 ` [RFC 3/7] nvme_fc: add dev_loss_tmo to controller jsmart2021
2017-05-04 18:07 ` [RFC 4/7] nvme_fc: check connectivity before initiating reconnects jsmart2021
2017-05-04 18:07 ` [RFC 5/7] nvme_fc: change failure code on remoteport connectivity loss jsmart2021
2017-05-04 18:07 ` [RFC 6/7] nvme_fc: move remote port get/put/free location jsmart2021
2017-05-04 18:07 ` [RFC 7/7] nvme_fc: add dev_loss_tmo timeout and remoteport resume support jsmart2021
2017-05-04 19:24 ` [RFC 0/7] nvme_fc: add dev_loss_tmo support James Smart
2017-05-04 21:07   ` Christoph Hellwig
2017-05-04 23:17     ` James Smart

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=20170504180737.5472-2-jsmart2021@gmail.com \
    --to=jsmart2021@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.