mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
nvme-fc: return non-zero status code when fails to create association
Return non-zero status code(-EIO) when needed, so re-connecting or deleting controller will be triggered properly. Signed-off-by: Michael Liang <mliang@purestorage.com> Reviewed-by: Caleb Sander <csander@purestorage.com> Reviewed-by: James Smart <jsmart2021@gmail.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
committed by
Keith Busch
parent
733ba346d9
commit
60e445bdfc
@@ -2551,6 +2551,9 @@ nvme_fc_error_recovery(struct nvme_fc_ctrl *ctrl, char *errmsg)
|
|||||||
if (ctrl->ctrl.state == NVME_CTRL_CONNECTING) {
|
if (ctrl->ctrl.state == NVME_CTRL_CONNECTING) {
|
||||||
__nvme_fc_abort_outstanding_ios(ctrl, true);
|
__nvme_fc_abort_outstanding_ios(ctrl, true);
|
||||||
set_bit(ASSOC_FAILED, &ctrl->flags);
|
set_bit(ASSOC_FAILED, &ctrl->flags);
|
||||||
|
dev_warn(ctrl->ctrl.device,
|
||||||
|
"NVME-FC{%d}: transport error during (re)connect\n",
|
||||||
|
ctrl->cnum);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3110,7 +3113,9 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
ret = nvme_enable_ctrl(&ctrl->ctrl);
|
ret = nvme_enable_ctrl(&ctrl->ctrl);
|
||||||
if (ret || test_bit(ASSOC_FAILED, &ctrl->flags))
|
if (!ret && test_bit(ASSOC_FAILED, &ctrl->flags))
|
||||||
|
ret = -EIO;
|
||||||
|
if (ret)
|
||||||
goto out_disconnect_admin_queue;
|
goto out_disconnect_admin_queue;
|
||||||
|
|
||||||
ctrl->ctrl.max_segments = ctrl->lport->ops->max_sgl_segments;
|
ctrl->ctrl.max_segments = ctrl->lport->ops->max_sgl_segments;
|
||||||
@@ -3120,7 +3125,9 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
|
|||||||
nvme_unquiesce_admin_queue(&ctrl->ctrl);
|
nvme_unquiesce_admin_queue(&ctrl->ctrl);
|
||||||
|
|
||||||
ret = nvme_init_ctrl_finish(&ctrl->ctrl, false);
|
ret = nvme_init_ctrl_finish(&ctrl->ctrl, false);
|
||||||
if (ret || test_bit(ASSOC_FAILED, &ctrl->flags))
|
if (!ret && test_bit(ASSOC_FAILED, &ctrl->flags))
|
||||||
|
ret = -EIO;
|
||||||
|
if (ret)
|
||||||
goto out_disconnect_admin_queue;
|
goto out_disconnect_admin_queue;
|
||||||
|
|
||||||
/* sanity checks */
|
/* sanity checks */
|
||||||
@@ -3165,7 +3172,9 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
|
|||||||
else
|
else
|
||||||
ret = nvme_fc_recreate_io_queues(ctrl);
|
ret = nvme_fc_recreate_io_queues(ctrl);
|
||||||
}
|
}
|
||||||
if (ret || test_bit(ASSOC_FAILED, &ctrl->flags))
|
if (!ret && test_bit(ASSOC_FAILED, &ctrl->flags))
|
||||||
|
ret = -EIO;
|
||||||
|
if (ret)
|
||||||
goto out_term_aen_ops;
|
goto out_term_aen_ops;
|
||||||
|
|
||||||
changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE);
|
changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE);
|
||||||
@@ -3180,6 +3189,9 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
|
|||||||
out_term_aen_ops:
|
out_term_aen_ops:
|
||||||
nvme_fc_term_aen_ops(ctrl);
|
nvme_fc_term_aen_ops(ctrl);
|
||||||
out_disconnect_admin_queue:
|
out_disconnect_admin_queue:
|
||||||
|
dev_warn(ctrl->ctrl.device,
|
||||||
|
"NVME-FC{%d}: create_assoc failed, assoc_id %llx ret %d\n",
|
||||||
|
ctrl->cnum, ctrl->association_id, ret);
|
||||||
/* send a Disconnect(association) LS to fc-nvme target */
|
/* send a Disconnect(association) LS to fc-nvme target */
|
||||||
nvme_fc_xmt_disconnect_assoc(ctrl);
|
nvme_fc_xmt_disconnect_assoc(ctrl);
|
||||||
spin_lock_irqsave(&ctrl->lock, flags);
|
spin_lock_irqsave(&ctrl->lock, flags);
|
||||||
|
|||||||
Reference in New Issue
Block a user