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: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-08-15 15:04:49 -07:00
parent 574a801941
commit ab7deee952

View File

@ -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);
}