From a13a359ebe58bb87c36437a93fbf35b4307c7d6c Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Mon, 14 Jan 2019 21:47:51 +0800 Subject: [PATCH] nvmf/tcp: fix the qpair disconnect handling. Due to qpair timeout handling refactoring, we removed the qpair destroying related code. And this patch is submitted to address this issue. With this patch, we can detect sock close of the fd from the initiator, and correctly free the qpair related resource (e.g., pid) managed by nvmf layer. Otherwise, the initatior thinks the qpair related source is freed, however it is not freed in the target side. Change-Id: Ia2de07bd849fa5d3bc0e0e0d4941464dfd16d266 Signed-off-by: Ziye Yang Reviewed-on: https://review.gerrithub.io/c/440242 Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker Chandler-Test-Pool: SPDK Automated Test System Tested-by: SPDK CI Jenkins --- lib/nvmf/tcp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/nvmf/tcp.c b/lib/nvmf/tcp.c index 9ae0eb576..e6156915f 100644 --- a/lib/nvmf/tcp.c +++ b/lib/nvmf/tcp.c @@ -2642,8 +2642,10 @@ spdk_nvmf_tcp_sock_cb(void *arg, struct spdk_sock_group *group, struct spdk_sock spdk_nvmf_tcp_qpair_process_pending(ttransport, tqpair); rc = spdk_nvmf_tcp_sock_process(tqpair); if (rc < 0) { - tqpair->state = NVME_TCP_QPAIR_STATE_EXITING; + tqpair->state = NVME_TCP_QPAIR_STATE_EXITED; spdk_nvmf_tcp_qpair_flush_pdus(tqpair); + SPDK_DEBUGLOG(SPDK_LOG_NVMF_TCP, "will disconect the tqpair=%p\n", tqpair); + spdk_nvmf_qpair_disconnect(&tqpair->qpair, NULL, NULL); } }