Commit 96e24801 authored by James Smart's avatar James Smart Committed by Christoph Hellwig

nvme-fc: check connectivity before initiating reconnects

Check remoteport connectivity before initiating reconnects
Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: default avatarHannes Reinecke <hare@suse.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent ac7fe82b
...@@ -808,7 +808,6 @@ fc_dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, ...@@ -808,7 +808,6 @@ fc_dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
dma_unmap_sg(dev, sg, nents, dir); dma_unmap_sg(dev, sg, nents, dir);
} }
/* *********************** FC-NVME LS Handling **************************** */ /* *********************** FC-NVME LS Handling **************************** */
static void nvme_fc_ctrl_put(struct nvme_fc_ctrl *); static void nvme_fc_ctrl_put(struct nvme_fc_ctrl *);
...@@ -2462,6 +2461,9 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl) ...@@ -2462,6 +2461,9 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
++ctrl->ctrl.nr_reconnects; ++ctrl->ctrl.nr_reconnects;
if (ctrl->rport->remoteport.port_state != FC_OBJSTATE_ONLINE)
return -ENODEV;
/* /*
* Create the admin queue * Create the admin queue
*/ */
...@@ -2682,6 +2684,10 @@ nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status) ...@@ -2682,6 +2684,10 @@ nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status)
ctrl->cnum, status); ctrl->cnum, status);
if (nvmf_should_reconnect(&ctrl->ctrl)) { 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, dev_info(ctrl->ctrl.device,
"NVME-FC{%d}: Reconnect attempt in %d seconds.\n", "NVME-FC{%d}: Reconnect attempt in %d seconds.\n",
ctrl->cnum, ctrl->ctrl.opts->reconnect_delay); ctrl->cnum, ctrl->ctrl.opts->reconnect_delay);
...@@ -2715,12 +2721,15 @@ nvme_fc_reset_ctrl_work(struct work_struct *work) ...@@ -2715,12 +2721,15 @@ nvme_fc_reset_ctrl_work(struct work_struct *work)
return; return;
} }
ret = nvme_fc_create_association(ctrl); if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE) {
if (ret) ret = nvme_fc_create_association(ctrl);
nvme_fc_reconnect_or_delete(ctrl, ret); if (ret)
else nvme_fc_reconnect_or_delete(ctrl, ret);
dev_info(ctrl->ctrl.device, else
"NVME-FC{%d}: controller reset complete\n", ctrl->cnum); dev_info(ctrl->ctrl.device,
"NVME-FC{%d}: controller reset complete\n",
ctrl->cnum);
}
} }
static const struct nvme_ctrl_ops nvme_fc_ctrl_ops = { static const struct nvme_ctrl_ops nvme_fc_ctrl_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment