nvme: extract qpair connect fail to a seprate function
In the next patch, the qpair is polled from a poll group and needs a disconnect callback, which should also fail the qpair, so it makes sense to have a separate function doing that. Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: Ied76431520962b25220027be829a4609afb6bbda Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9157 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
parent
771f65bb1f
commit
5263f0a12f
@ -349,6 +349,17 @@ nvme_transport_ctrlr_delete_io_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
nvme_transport_connect_qpair_fail(struct spdk_nvme_qpair *qpair)
|
||||||
|
{
|
||||||
|
struct spdk_nvme_ctrlr *ctrlr = qpair->ctrlr;
|
||||||
|
|
||||||
|
/* If the qpair was unable to reconnect, restore the original failure reason */
|
||||||
|
qpair->transport_failure_reason = qpair->last_transport_failure_reason;
|
||||||
|
nvme_transport_ctrlr_disconnect_qpair(ctrlr, qpair);
|
||||||
|
nvme_qpair_set_state(qpair, NVME_QPAIR_DISCONNECTED);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
nvme_transport_ctrlr_connect_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair *qpair)
|
nvme_transport_ctrlr_connect_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_qpair *qpair)
|
||||||
{
|
{
|
||||||
@ -387,12 +398,8 @@ nvme_transport_ctrlr_connect_qpair(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nv
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
/* If the qpair was unable to reconnect, restore the original failure reason. */
|
nvme_transport_connect_qpair_fail(qpair);
|
||||||
qpair->transport_failure_reason = qpair->last_transport_failure_reason;
|
|
||||||
nvme_transport_ctrlr_disconnect_qpair(ctrlr, qpair);
|
|
||||||
nvme_qpair_set_state(qpair, NVME_QPAIR_DISCONNECTED);
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user