From 78ca4b27c51d0f869acb58748d5a6eb7c7660a9f Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Mon, 25 Jul 2022 14:49:11 +0800 Subject: [PATCH] nvmf: don't raise assertion when destroying an non-inactive subsystem Sometimes VM may get a kernel panic when starting, and SPDK CI will kill `nvmf_tgt` after 60 seconds, and for this exception, SPDK will raise an assertion when destroying the subsystem, while here, we remove this assertion and print the error information. CI will still mark this case as a failed case, then we can use this error information to understand error subsystem state in vfio-user. Fix issue #2590. Change-Id: I20b16f9e96a566730eca2dd9ea165645bd9160bd Signed-off-by: Changpeng Liu Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13773 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Dong Yi Reviewed-by: Ben Walker --- lib/nvmf/subsystem.c | 4 ++-- module/event/subsystems/nvmf/nvmf_tgt.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/nvmf/subsystem.c b/lib/nvmf/subsystem.c index 9c0ed54d7..c0a537a10 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\n"); - assert(0); + SPDK_ERRLOG("Subsystem can only be destroyed in inactive state, current state %d\n", + 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 8630864cc..d65c1619b 100644 --- a/module/event/subsystems/nvmf/nvmf_tgt.c +++ b/module/event/subsystems/nvmf/nvmf_tgt.c @@ -232,7 +232,8 @@ nvmf_tgt_subsystem_stopped(struct spdk_nvmf_subsystem *subsystem, if (subsystem) { rc = spdk_nvmf_subsystem_stop(subsystem, nvmf_tgt_subsystem_stopped, NULL); if (rc) { - SPDK_ERRLOG("Unable to stop NVMe-oF subsystem. Trying others.\n"); + SPDK_ERRLOG("Unable to stop NVMe-oF subsystem %s with rc %d, Trying others.\n", + spdk_nvmf_subsystem_get_nqn(subsystem), rc); nvmf_tgt_subsystem_stopped(subsystem, NULL, 0); } return;