Commit ab7deee9 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

nvmf: fix double subsystem list removal



spdk_shutdown_nvmf_subsystems() was removing the subsystem from the
list, but nvmf_delete_subsystem() also wants to remove it, so drop the
extra removal.

Also rewrite the shutdown loop as a TAILQ_FOREACH_SAFE() to make the
static analyzer happy (and make it more obvious that the loop will
terminate).

Change-Id: Iccadafa77d9cd3e26be21c0f11e62cfc1ef0197c
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 574a8019
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -269,11 +269,9 @@ spdk_format_discovery_log(struct spdk_nvmf_discovery_log_page *disc_log, uint32_
int
spdk_shutdown_nvmf_subsystems(void)
{
	struct spdk_nvmf_subsystem *subsystem;
	struct spdk_nvmf_subsystem *subsystem, *subsys_tmp;

	while (!TAILQ_EMPTY(&g_subsystems)) {
		subsystem = TAILQ_FIRST(&g_subsystems);
		TAILQ_REMOVE(&g_subsystems, subsystem, entries);
	TAILQ_FOREACH_SAFE(subsystem, &g_subsystems, entries, subsys_tmp) {
		nvmf_delete_subsystem(subsystem);
	}