nvme: break out rdma disconnect from destroy

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I2ce5413635c68403edf532e53d8e15d04f0fd6c5

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453933
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Jim Harris 2019-05-09 12:12:29 -07:00 committed by Changpeng Liu
parent 963e450a71
commit e7d8c05b5d

View File

@ -1326,24 +1326,14 @@ nvme_rdma_ctrlr_create_qpair(struct spdk_nvme_ctrlr *ctrlr,
return qpair;
}
static int
nvme_rdma_qpair_destroy(struct spdk_nvme_qpair *qpair)
static void
nvme_rdma_qpair_disconnect(struct spdk_nvme_qpair *qpair)
{
struct nvme_rdma_qpair *rqpair;
if (!qpair) {
return -1;
}
nvme_rdma_qpair_abort_reqs(qpair, 1);
nvme_qpair_deinit(qpair);
rqpair = nvme_rdma_qpair(qpair);
struct nvme_rdma_qpair *rqpair = nvme_rdma_qpair(qpair);
nvme_rdma_unregister_mem(rqpair);
nvme_rdma_unregister_reqs(rqpair);
nvme_rdma_free_reqs(rqpair);
nvme_rdma_unregister_rsps(rqpair);
nvme_rdma_free_rsps(rqpair);
if (rqpair->cm_id) {
if (rqpair->cm_id->qp) {
@ -1359,7 +1349,24 @@ nvme_rdma_qpair_destroy(struct spdk_nvme_qpair *qpair)
if (rqpair->cm_channel) {
rdma_destroy_event_channel(rqpair->cm_channel);
}
}
static int
nvme_rdma_qpair_destroy(struct spdk_nvme_qpair *qpair)
{
struct nvme_rdma_qpair *rqpair;
if (!qpair) {
return -1;
}
nvme_rdma_qpair_disconnect(qpair);
nvme_rdma_qpair_abort_reqs(qpair, 1);
nvme_qpair_deinit(qpair);
rqpair = nvme_rdma_qpair(qpair);
nvme_rdma_free_reqs(rqpair);
nvme_rdma_free_rsps(rqpair);
free(rqpair);
return 0;