Commit 6fb6fda9 authored by Curt Bruns's avatar Curt Bruns Committed by Tomasz Zawadzki
Browse files

nvme: Fix ZNS assert for NS_ATTR_CHANGED AEN



For a ZNS drive, there is a block of memory (nsdata_zns) that is
allocated when the ZNS drive is enumerated. This memory is already
allocated when the controller code goes to re-construct the
namespace for an SPDK_NVME_ASYNC_EVENT_NS_ATTR_CHANGED AEN so the
controller code asserts.

This commit will fix the assert by destroying (freeing) the
namespace structure before re-creating it.

Fixes #3028

Change-Id: I2e75077dce727cc1c912c8f980e4d78c1be328ba
Signed-off-by: default avatarCurt Bruns <curt.e.bruns@gmail.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/18251


Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 924c2994
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2975,6 +2975,7 @@ nvme_ctrlr_update_namespaces(struct spdk_nvme_ctrlr *ctrlr)
	for (nsid = spdk_nvme_ctrlr_get_first_active_ns(ctrlr);
	     nsid != 0; nsid = spdk_nvme_ctrlr_get_next_active_ns(ctrlr, nsid)) {
		ns = spdk_nvme_ctrlr_get_ns(ctrlr, nsid);
		nvme_ns_destruct(ns);
		nvme_ns_construct(ns, nsid, ctrlr);
	}
}