nvme: break out tcp disconnect from destroy

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

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/453935
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:43:50 -07:00 committed by Changpeng Liu
parent e7d8c05b5d
commit 3895ca40d9

View File

@ -227,6 +227,14 @@ fail:
return -ENOMEM;
}
static void
nvme_tcp_qpair_disconnect(struct spdk_nvme_qpair *qpair)
{
struct nvme_tcp_qpair *tqpair = nvme_tcp_qpair(qpair);
spdk_sock_close(&tqpair->sock);
}
static int
nvme_tcp_qpair_destroy(struct spdk_nvme_qpair *qpair)
{
@ -236,14 +244,11 @@ nvme_tcp_qpair_destroy(struct spdk_nvme_qpair *qpair)
return -1;
}
nvme_tcp_qpair_disconnect(qpair);
nvme_tcp_qpair_abort_reqs(qpair, 1);
nvme_qpair_deinit(qpair);
tqpair = nvme_tcp_qpair(qpair);
nvme_tcp_free_reqs(tqpair);
spdk_sock_close(&tqpair->sock);
free(tqpair);
return 0;