From: jsmart2021@gmail.com (James Smart)
Subject: [PATCH v4 4/5] nvme_fc: check connectivity before initiating reconnects
Date: Wed, 25 Oct 2017 16:43:16 -0700 [thread overview]
Message-ID: <20171025234317.13302-5-jsmart2021@gmail.com> (raw)
In-Reply-To: <20171025234317.13302-1-jsmart2021@gmail.com>
check remoteport connectivity before initiating reconnects
Signed-off-by: James Smart <james.smart at broadcom.com>
Reviewed-by: Johannes Thumshirn <jthumshirn at suse.de>
Reviewed-by: Hannes Reinecke <hare at suse.com>
---
drivers/nvme/host/fc.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 0e10a24a8786..78ec1d47d1fc 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -810,7 +810,6 @@ fc_dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
dma_unmap_sg(dev, sg, nents, dir);
}
-
/* *********************** FC-NVME LS Handling **************************** */
static void nvme_fc_ctrl_put(struct nvme_fc_ctrl *);
@@ -2464,6 +2463,9 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
++ctrl->ctrl.nr_reconnects;
+ if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE)
+ return -ENODEV;
+
/*
* Create the admin queue
*/
@@ -2739,6 +2741,10 @@ nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status)
ctrl->cnum, status);
if (nvmf_should_reconnect(&ctrl->ctrl)) {
+ /* Only schedule the reconnect if the remote port is online */
+ if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE)
+ return;
+
dev_info(ctrl->ctrl.device,
"NVME-FC{%d}: Reconnect attempt in %d seconds.\n",
ctrl->cnum, ctrl->ctrl.opts->reconnect_delay);
@@ -2772,12 +2778,15 @@ nvme_fc_reset_ctrl_work(struct work_struct *work)
return;
}
- ret = nvme_fc_create_association(ctrl);
- if (ret)
- nvme_fc_reconnect_or_delete(ctrl, ret);
- else
- dev_info(ctrl->ctrl.device,
- "NVME-FC{%d}: controller reset complete\n", ctrl->cnum);
+ if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE) {
+ ret = nvme_fc_create_association(ctrl);
+ if (ret)
+ nvme_fc_reconnect_or_delete(ctrl, ret);
+ else
+ dev_info(ctrl->ctrl.device,
+ "NVME-FC{%d}: controller reset complete\n",
+ ctrl->cnum);
+ }
}
static const struct nvme_ctrl_ops nvme_fc_ctrl_ops = {
--
2.13.1
next prev parent reply other threads:[~2017-10-25 23:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-25 23:43 [PATCH v4 0/5] nvme_fc: add dev_loss_tmo support James Smart
2017-10-25 23:43 ` [PATCH v4 1/5] nvme core: allow controller RESETTING to RECONNECTING transition James Smart
2017-10-25 23:43 ` [PATCH v4 2/5] nvme_fc: change ctlr state assignments during reset/reconnect James Smart
2017-10-25 23:43 ` [PATCH v4 3/5] nvme_fc: add a dev_loss_tmo field to the remoteport James Smart
2017-10-25 23:43 ` James Smart [this message]
2017-10-25 23:43 ` [PATCH v4 5/5] nvme_fc: add dev_loss_tmo timeout and remoteport resume support James Smart
2017-10-27 7:16 ` Hannes Reinecke
2017-11-01 15:35 ` [PATCH v4 0/5] nvme_fc: add dev_loss_tmo support Christoph Hellwig
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=20171025234317.13302-5-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).