Commit 6d7be198 authored by Marcin Galecki's avatar Marcin Galecki Committed by Jim Harris
Browse files

lib/nvmf: remove redundant ANA notifications



In NVMe 2.0 Asymmetric Namespace Access Change was changed to remove
redundant notifications due to detachment of a namespaces.
Per spec:
"A controller shall not send this event if a Namespace Attribute Changed
notice is sent for the same event, such as a change due to:
a) the attachment of a namespace (refer to section 5.22);
b) the deletion of a namespace (refer to section 5.23); or
c) the detachment of a namespace (refer to section 5.22)."

Change-Id: Id21351841ea8da31e208caa7daf0a0b815d989c7
Signed-off-by: default avatarMarcin Galecki <marcin.galecki@dell.com>
Reviewed-on: https://review.spdk.io/c/spdk/spdk/+/26908


Reviewed-by: default avatarJacek Kalwas <jacek.kalwas@nutanix.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK Automated Test System <spdkbot@gmail.com>
Reviewed-by: default avatarJim Harris <jim.harris@nvidia.com>
parent 50a33791
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -1469,7 +1469,7 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
	struct spdk_io_channel *ch;
	struct spdk_nvmf_subsystem_pg_ns_info *ns_info;
	struct spdk_nvmf_ctrlr *ctrlr;
	bool ns_changed;
	bool ns_changed, ana_changed;

	/* Make sure our poll group has memory for this subsystem allocated */
	if (subsystem->id >= group->num_sgroups) {
@@ -1489,6 +1489,7 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
	}

	ns_changed = false;
	ana_changed = false;

	/* Detect bdevs that were added or removed */
	for (i = 0; i < sgroup->num_ns; i++) {
@@ -1543,7 +1544,7 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
				      group,
				      ns_info->anagrpid,
				      ns->anagrpid);
			ns_changed = true;
			ana_changed = true;
		}

		if (ns == NULL) {
@@ -1556,7 +1557,7 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
		}
	}

	if (ns_changed) {
	if (ns_changed || ana_changed) {
		TAILQ_FOREACH(ctrlr, &subsystem->ctrlrs, link) {
			if (ctrlr->thread != spdk_get_thread()) {
				continue;
@@ -1568,11 +1569,15 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
				continue;
			}
			if (ctrlr->admin_qpair->group == group) {
				if (ns_changed) {
					nvmf_ctrlr_async_event_ns_notice(ctrlr);
				}
				if (ana_changed) {
					nvmf_ctrlr_async_event_ana_change_notice(ctrlr);
				}
			}
		}
	}

	return 0;
}