Commit 27d031cd authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Tomasz Zawadzki
Browse files

bdev/nvme: Remove assert() to detect ANA change for inactive namespace



nvme_ctrlr_set_ana_states() was good but it had undesirable assert().
nvme_ctrlr_set_ana_states() could handle the case that target sent ANA
change for inactive namespaces, but hit assert() for the case.

The case was observed in real environment. Remove the undesirable
assert() and add unit test case to avoid future degradation.

Signed-off-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Suggested-by: default avatarKaushik Chug <kaushik.chug@ngxstorage.com>
Change-Id: If77fdb1180e759b6b7ede8dc8802513d8937c2b4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/24165


Community-CI: Mellanox Build Bot
Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: Kaushik Chug
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
parent 6e94e7fd
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -4843,7 +4843,6 @@ nvme_ctrlr_set_ana_states(const struct spdk_nvme_ana_group_descriptor *desc,

		nvme_ns = nvme_ctrlr_get_ns(nvme_ctrlr, nsid);

		assert(nvme_ns != NULL);
		if (nvme_ns == NULL) {
			/* Target told us that an inactive namespace had an ANA change */
			continue;
+16 −0
Original line number Diff line number Diff line
@@ -4951,6 +4951,22 @@ test_concurrent_read_ana_log_page(void)

	set_thread(0);

	/* It is possible that target sent ANA change for inactive namespaces.
	 *
	 * Previously, assert() was added because this case was unlikely.
	 * However, assert() was hit in real environment.

	 * Hence, remove assert() and add unit test case.
	 *
	 * Simulate this case by depopulating namespaces and then parsing ANA
	 * log page created when all namespaces are active.
	 * Then, check if parsing ANA log page completes successfully.
	 */
	nvme_ctrlr_depopulate_namespaces(nvme_ctrlr);

	rc = bdev_nvme_parse_ana_log_page(nvme_ctrlr, nvme_ctrlr_set_ana_states, nvme_ctrlr);
	CU_ASSERT(rc == 0);

	rc = bdev_nvme_delete("nvme0", &g_any_path, NULL, NULL);
	CU_ASSERT(rc == 0);