nvmf: Delay sending AER until subsystem resumes

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/464614 (master)

(cherry picked from commit 1e82ec0640)
Change-Id: Id5152a793c6b530cb1419c559ac3ed71ee042037
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467134
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ben Walker 2019-08-08 14:15:17 -07:00
parent 9d2615484a
commit fa7fd77b62
2 changed files with 15 additions and 2 deletions

View File

@ -1331,8 +1331,6 @@ spdk_nvmf_ctrlr_ns_changed(struct spdk_nvmf_ctrlr *ctrlr, uint32_t nsid)
ctrlr->changed_ns_list.ns_list[ctrlr->changed_ns_list_count++] = nsid;
}
}
spdk_nvmf_ctrlr_async_event_ns_notice(ctrlr);
}
static void

View File

@ -872,6 +872,8 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
struct spdk_nvmf_registrant *reg, *tmp;
struct spdk_io_channel *ch;
struct spdk_nvmf_subsystem_pg_ns_info *ns_info;
struct spdk_nvmf_ctrlr *ctrlr;
bool ns_changed;
/* Make sure our poll group has memory for this subsystem allocated */
if (subsystem->id >= group->num_sgroups) {
@ -884,6 +886,8 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
new_num_ns = subsystem->max_nsid;
old_num_ns = sgroup->num_ns;
ns_changed = false;
if (old_num_ns == 0) {
if (new_num_ns > 0) {
/* First allocation */
@ -945,10 +949,12 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
/* Both NULL. Leave empty */
} else if (ns == NULL && ch != NULL) {
/* There was a channel here, but the namespace is gone. */
ns_changed = true;
spdk_put_io_channel(ch);
ns_info->channel = NULL;
} else if (ns != NULL && ch == NULL) {
/* A namespace appeared but there is no channel yet */
ns_changed = true;
ch = spdk_bdev_get_io_channel(ns->desc);
if (ch == NULL) {
SPDK_ERRLOG("Could not allocate I/O channel.\n");
@ -957,6 +963,7 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
ns_info->channel = ch;
} else if (spdk_uuid_compare(&ns_info->uuid, spdk_bdev_get_uuid(ns->bdev)) != 0) {
/* A namespace was here before, but was replaced by a new one. */
ns_changed = true;
spdk_put_io_channel(ns_info->channel);
memset(ns_info, 0, sizeof(*ns_info));
@ -990,6 +997,14 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
}
}
if (ns_changed) {
TAILQ_FOREACH(ctrlr, &subsystem->ctrlrs, link) {
if (ctrlr->admin_qpair->group == group) {
spdk_nvmf_ctrlr_async_event_ns_notice(ctrlr);
}
}
}
return 0;
}