Skip to content

Commit caf1cbe

Browse files
James SmartChristoph Hellwig
authored andcommitted
nvme-fc: track error_recovery while connecting
Whenever there are errors during CONNECTING, the driver recovers by aborting all outstanding ios and counts on the io completion to fail them and thus the connection/association they are on. However, the connection failure depends on a failure state from the core routines. Not all commands that are issued by the core routine are guaranteed to cause a failure of the core routine. They may be treated as a failure status and the status is then ignored. As such, whenever the transport enters error_recovery while CONNECTING, it will set a new flag indicating an association failed. The create_association routine which creates and initializes the controller, will monitor the state of the flag as well as the core routine error status and ensure the association fails if there was an error. Signed-off-by: James Smart <james.smart@broadcom.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 25c1ca6 commit caf1cbe

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

  • drivers/nvme/host

drivers/nvme/host/fc.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ struct nvme_fc_rport {
146146

147147
/* fc_ctrl flags values - specified as bit positions */
148148
#define ASSOC_ACTIVE 0
149-
#define FCCTRL_TERMIO 1
149+
#define ASSOC_FAILED 1
150+
#define FCCTRL_TERMIO 2
150151

151152
struct nvme_fc_ctrl {
152153
spinlock_t lock;
@@ -2988,6 +2989,8 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
29882989
ctrl->cnum, ctrl->lport->localport.port_name,
29892990
ctrl->rport->remoteport.port_name, ctrl->ctrl.opts->subsysnqn);
29902991

2992+
clear_bit(ASSOC_FAILED, &ctrl->flags);
2993+
29912994
/*
29922995
* Create the admin queue
29932996
*/
@@ -3016,7 +3019,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
30163019
*/
30173020

30183021
ret = nvme_enable_ctrl(&ctrl->ctrl);
3019-
if (ret)
3022+
if (ret || test_bit(ASSOC_FAILED, &ctrl->flags))
30203023
goto out_disconnect_admin_queue;
30213024

30223025
ctrl->ctrl.max_segments = ctrl->lport->ops->max_sgl_segments;
@@ -3026,7 +3029,7 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
30263029
blk_mq_unquiesce_queue(ctrl->ctrl.admin_q);
30273030

30283031
ret = nvme_init_identify(&ctrl->ctrl);
3029-
if (ret)
3032+
if (ret || test_bit(ASSOC_FAILED, &ctrl->flags))
30303033
goto out_disconnect_admin_queue;
30313034

30323035
/* sanity checks */
@@ -3071,9 +3074,9 @@ nvme_fc_create_association(struct nvme_fc_ctrl *ctrl)
30713074
ret = nvme_fc_create_io_queues(ctrl);
30723075
else
30733076
ret = nvme_fc_recreate_io_queues(ctrl);
3074-
if (ret)
3075-
goto out_term_aen_ops;
30763077
}
3078+
if (ret || test_bit(ASSOC_FAILED, &ctrl->flags))
3079+
goto out_term_aen_ops;
30773080

30783081
changed = nvme_change_ctrl_state(&ctrl->ctrl, NVME_CTRL_LIVE);
30793082

@@ -3301,6 +3304,7 @@ __nvme_fc_terminate_io(struct nvme_fc_ctrl *ctrl)
33013304
*/
33023305
if (ctrl->ctrl.state == NVME_CTRL_CONNECTING) {
33033306
__nvme_fc_abort_outstanding_ios(ctrl, true);
3307+
set_bit(ASSOC_FAILED, &ctrl->flags);
33043308
return;
33053309
}
33063310

0 commit comments

Comments
 (0)