From: jsmart2021@gmail.com (James Smart)
Subject: [PATCH v3 2/5] nvme_fc: change ctlr state assignments during reset/reconnect
Date: Tue, 17 Oct 2017 16:32:45 -0700 [thread overview]
Message-ID: <20171017233248.6769-3-jsmart2021@gmail.com> (raw)
In-Reply-To: <20171017233248.6769-1-jsmart2021@gmail.com>
Clean up some of the controller state checks and add the
RESETTING->RECONNECTING state transition.
Specifically:
- the movement of the RESETTING state change and schedule of
reset_work to core doesn't work wiht nvme_fc_error_recovery
setting state to RECONNECTING before attempting to reset.
Remove the state change as the reset request does it.
- In the rare cases where an error occurs right as we're
transitioning to LIVE, defer the controller start actions.
- In error handling on teardown of associations while
performing initial controller creation - avoid quiesce
calls on the admin_q. They are unneeded.
- Add the RESETTING->RECONNECTING transition in the reset
handler.
Signed-off-by: James Smart <james.smart at broadcom.com>
Reviewed-by: Christoph Hellwig <hch at lst.de>
---
v3: no change. incorporated Reviewed-by's
---
drivers/nvme/host/fc.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 48c241620d2b..5afb518c39ad 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -1881,13 +1881,6 @@ nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg)
dev_warn(ctrl->ctrl.device,
"NVME-FC{%d}: resetting controller\n", ctrl->cnum);
- if (!nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_RECONNECTING)) {
- dev_err(ctrl->ctrl.device,
- "NVME-FC{%d}: error_recovery: Couldn't change state "
- "to RECONNECTING\n", ctrl->cnum);
- return;
- }
-
nvme_reset_ctrl(&ctrl->ctrl);
}
@@ -2521,11 +2514,11 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
}
changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE);
- WARN_ON_ONCE(!changed);
ctrl->ctrl.nr_reconnects = 0;
- nvme_start_ctrl(&ctrl->ctrl);
+ if (changed)
+ nvme_start_ctrl(&ctrl->ctrl);
return 0; /* Success */
@@ -2593,7 +2586,8 @@ nvme_fc_delete_association(struct nvme_fc_ctrl *ctrl)
* use blk_mq_tagset_busy_itr() and the transport routine to
* terminate the exchanges.
*/
- blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
+ if (ctrl->ctrl.state != NVME_CTRL_NEW)
+ blk_mq_quiesce_queue(ctrl->ctrl.admin_q);
blk_mq_tagset_busy_iter(&ctrl->admin_tag_set,
nvme_fc_terminate_exchange, &ctrl->ctrl);
@@ -2697,12 +2691,8 @@ nvme_fc_del_nvme_ctrl(struct nvme_ctrl *nctrl)
static void
nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status)
{
- /* If we are resetting/deleting then do nothing */
- if (ctrl->ctrl.state != NVME_CTRL_RECONNECTING) {
- WARN_ON_ONCE(ctrl->ctrl.state == NVME_CTRL_NEW ||
- ctrl->ctrl.state == NVME_CTRL_LIVE);
+ if (ctrl->ctrl.state != NVME_CTRL_RECONNECTING)
return;
- }
dev_info(ctrl->ctrl.device,
"NVME-FC{%d}: reset: Reconnect attempt failed (%d)\n",
@@ -2731,9 +2721,17 @@ nvme_fc_reset_ctrl_work(struct work_struct *work)
int ret;
nvme_stop_ctrl(&ctrl->ctrl);
+
/* 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}: error_recovery: 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.13.1
next prev parent reply other threads:[~2017-10-17 23:32 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-17 23:32 [PATCH v3 0/5] nvme_fc: add dev_loss_tmo support James Smart
2017-10-17 23:32 ` [PATCH v3 1/5] nvme core: allow controller RESETTING to RECONNECTING transition James Smart
2017-10-18 8:26 ` Johannes Thumshirn
2017-10-20 5:58 ` Hannes Reinecke
2017-10-17 23:32 ` James Smart [this message]
2017-10-18 8:27 ` [PATCH v3 2/5] nvme_fc: change ctlr state assignments during reset/reconnect Johannes Thumshirn
2017-10-20 6:00 ` Hannes Reinecke
2017-10-17 23:32 ` [PATCH v3 3/5] nvme_fc: add a dev_loss_tmo field to the remoteport James Smart
2017-10-18 8:28 ` Johannes Thumshirn
2017-10-20 6:04 ` Hannes Reinecke
2017-10-20 14:50 ` James Smart
2017-10-17 23:32 ` [PATCH v3 4/5] nvme_fc: check connectivity before initiating reconnects James Smart
2017-10-18 8:29 ` Johannes Thumshirn
2017-10-20 6:05 ` Hannes Reinecke
2017-10-17 23:32 ` [PATCH v3 5/5] nvme_fc: add dev_loss_tmo timeout and remoteport resume support James Smart
2017-10-19 15:46 ` Trapp, Darren
2017-10-19 18:04 ` James Smart
2017-10-19 19:49 ` Trapp, Darren
2017-10-20 6:27 ` Hannes Reinecke
2017-10-20 18:53 ` 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=20171017233248.6769-3-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).