From 38980dedfa740e176739f21cd0a1d8a643e10e6d Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Mon, 6 Feb 2017 13:25:56 +0800 Subject: [PATCH] nvmf,tgt: fix issue while shutting down nvmf tgt with CTRL + C The phenoemon is that we can not shutdown the nvmf tgt. The solution is that we need to adjust the shutting down orders of nvmf tgt subsystem and rdma trasport layer. Change-Id: Ie39657370b1574960e0ee7cf604cc5872db0bed3 Signed-off-by: Ziye Yang --- app/nvmf_tgt/nvmf_tgt.c | 2 +- lib/nvmf/rdma.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/nvmf_tgt/nvmf_tgt.c b/app/nvmf_tgt/nvmf_tgt.c index 0a1ea9f4c..b9c8a09c5 100644 --- a/app/nvmf_tgt/nvmf_tgt.c +++ b/app/nvmf_tgt/nvmf_tgt.c @@ -75,6 +75,7 @@ subsystem_delete_event(void *arg1, void *arg2) spdk_nvmf_delete_subsystem(subsystem); if (g_subsystems_shutdown && TAILQ_EMPTY(&g_subsystems)) { + spdk_nvmf_tgt_fini(); /* Finished shutting down all subsystems - continue the shutdown process. */ shutdown_complete(); } @@ -118,7 +119,6 @@ shutdown_subsystems(void) static void acceptor_poller_unregistered_event(void *arg1, void *arg2) { - spdk_nvmf_tgt_fini(); shutdown_subsystems(); } diff --git a/lib/nvmf/rdma.c b/lib/nvmf/rdma.c index ef47d8dbd..67bddba97 100644 --- a/lib/nvmf/rdma.c +++ b/lib/nvmf/rdma.c @@ -1012,6 +1012,8 @@ static int spdk_nvmf_rdma_fini(void) { pthread_mutex_lock(&g_rdma.lock); + + assert(TAILQ_EMPTY(&g_rdma.listen_addrs)); if (g_rdma.event_channel != NULL) { rdma_destroy_event_channel(g_rdma.event_channel); }