From 80c88ab355a600b80ddaf9e0e82505970fefed97 Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Tue, 18 Jan 2022 15:40:54 +0800 Subject: [PATCH] nvme: disconnect ADMIN queue pair when destruct controller We should disconnect ADMIN queue pair after shutdown returned, or we may leak ADMIN socket resources after free the controller data structure. Fix issue #2289. Change-Id: I956191fcd51cdcef5de2c3c7b15ffc70f22b040b Signed-off-by: Changpeng Liu Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11133 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Dong Yi Reviewed-by: Reviewed-by: Konrad Sztyber --- lib/nvme/nvme_ctrlr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c index dd4601a1c7..38a1de0249 100644 --- a/lib/nvme/nvme_ctrlr.c +++ b/lib/nvme/nvme_ctrlr.c @@ -4181,6 +4181,8 @@ nvme_ctrlr_destruct_poll_async(struct spdk_nvme_ctrlr *ctrlr, ctx->cb_fn(ctrlr); } + nvme_transport_ctrlr_disconnect_qpair(ctrlr, ctrlr->adminq); + RB_FOREACH_SAFE(ns, nvme_ns_tree, &ctrlr->ns, tmp_ns) { nvme_ctrlr_destruct_namespace(ctrlr, ns->id); RB_REMOVE(nvme_ns_tree, &ctrlr->ns, ns);