From c60cb1a8bee1e840108810dd62cfb9ad607d5f73 Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Wed, 3 Aug 2022 12:44:12 +0800 Subject: [PATCH] lib/nvmf: don't raise assertion in `nvmf_tgt_destroy_cb` While running into this function, even the subsystem can't be destroyed due to error subsystem state, it's better to continue the execution. Continue to fix #2590, QEMU is stuck for the failure case, and nvmf target should process such error because it may support other normal subsystems at the same time. Change-Id: Ib05e24996378b52070d2b760519f476f9b2d7e76 Signed-off-by: Changpeng Liu Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13839 Tested-by: SPDK CI Jenkins Reviewed-by: Aleksey Marchuk Reviewed-by: Dong Yi Reviewed-by: Jim Harris --- lib/nvmf/nvmf.c | 3 +-- lib/nvmf/subsystem.c | 4 ++-- module/event/subsystems/nvmf/nvmf_tgt.c | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/nvmf/nvmf.c b/lib/nvmf/nvmf.c index 623474465..7dd4f3d2a 100644 --- a/lib/nvmf/nvmf.c +++ b/lib/nvmf/nvmf.c @@ -367,8 +367,7 @@ nvmf_tgt_destroy_cb(void *io_device) * is destroyed, nvmf_tgt_destroy_cb will continue to destroy other subsystems if any */ return; } else { - SPDK_ERRLOG("Failed to destroy subsystem, id %u, rc %d\n", tgt->subsystems[i]->id, rc); - assert(0); + SPDK_ERRLOG("Failed to destroy subsystem %s, rc %d\n", tgt->subsystems[i]->subnqn, rc); } } } diff --git a/lib/nvmf/subsystem.c b/lib/nvmf/subsystem.c index c0a537a10..c4fa1461c 100644 --- a/lib/nvmf/subsystem.c +++ b/lib/nvmf/subsystem.c @@ -420,8 +420,8 @@ spdk_nvmf_subsystem_destroy(struct spdk_nvmf_subsystem *subsystem, nvmf_subsyste assert(spdk_get_thread() == subsystem->thread); if (subsystem->state != SPDK_NVMF_SUBSYSTEM_INACTIVE) { - SPDK_ERRLOG("Subsystem can only be destroyed in inactive state, current state %d\n", - subsystem->state); + SPDK_ERRLOG("Subsystem can only be destroyed in inactive state, %s state %d\n", + subsystem->subnqn, subsystem->state); return -EAGAIN; } if (subsystem->destroying) { diff --git a/module/event/subsystems/nvmf/nvmf_tgt.c b/module/event/subsystems/nvmf/nvmf_tgt.c index d65c1619b..b8bb0f3b2 100644 --- a/module/event/subsystems/nvmf/nvmf_tgt.c +++ b/module/event/subsystems/nvmf/nvmf_tgt.c @@ -260,7 +260,8 @@ _nvmf_tgt_subsystem_destroy(void *cb_arg) * is destroyed, _nvmf_tgt_subsystem_destroy will continue to destroy other subsystems if any */ return; } else { - SPDK_ERRLOG("Unable to destroy NVMe-oF subsystem, rc %d. Trying others.\n", rc); + SPDK_ERRLOG("Unable to destroy subsystem %s, rc %d. Trying others.\n", + spdk_nvmf_subsystem_get_nqn(subsystem), rc); } } subsystem = next_subsystem;