Commit c60cb1a8 authored by Changpeng Liu's avatar Changpeng Liu Committed by Tomasz Zawadzki
Browse files

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: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13839


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: default avatarDong Yi <dongx.yi@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 3dd0bc9e
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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);
					}
				}
			}
+2 −2
Original line number Diff line number Diff line
@@ -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) {
+2 −1
Original line number Diff line number Diff line
@@ -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;