Commit bc4b2d51 authored by Tomasz Zawadzki's avatar Tomasz Zawadzki Committed by Tomasz Zawadzki
Browse files

lib/nvme: match state active state of ns after identify



nvme_ctrlr_construct_namespace() marks namespaces as active immidietly after
identify controller is received. In practive the state of the namespace
can change before identify namespace is received.

Despite that after reading nsdata it remained in previous state.
nvme_ns_construct() continued without interruption, finally reaching
nvme_ctrlr_populate_namespaces() still marked as active. Which assumed that
zero filled size meant a resize.

It could have been observed by following notice:
bdev_nvme.c:5143:nvme_ctrlr_populate_namespaces: *NOTICE*: [nqn.2016-06.io.spdk:testnqn, 1] NSID 169 is resized: bdev name nvme0n169, old size 25600, new size 0

To fix that, make sure to set appropriate ns state from identify ns data.

The test exposes this issue by increasing number of threads sending the
add/remove_ns RPCs to the target. This means that target will now handle that
many RPCs at once.

8 threads was found to be the sweetspot to reproduce this issue on every
test run in my setup.

Change-Id: I435e91e598a77ff77d4b028157b7ef49e8f4af14
Signed-off-by: default avatarTomasz Zawadzki <tomasz.zawadzki@nutanix.com>
Reviewed-on: https://review.spdk.io/c/spdk/spdk/+/26397


Reviewed-by: default avatarBen Walker <ben@nvidia.com>
Reviewed-by: default avatarJim Harris <jim.harris@nvidia.com>
Reviewed-by: default avatarJacek Kalwas <jacek.kalwas@nutanix.com>
Tested-by: default avatarSPDK Automated Test System <spdkbot@gmail.com>
Community-CI: Mellanox Build Bot
parent 0037685d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -96,6 +96,8 @@ nvme_ns_set_identify_data(struct spdk_nvme_ns *ns)
			ns->pi_format = SPDK_NVME_16B_GUARD_PI;
		}
	}

	ns->active = spdk_nvme_ns_is_active(ns);
}

static int
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ trap 'killprocess $spdk_app_pid; nvmftestfini; exit 1' SIGINT SIGTERM EXIT
waitforlisten "$spdk_app_pid"

# Run several subsystem_{add,remove}_ns RPCs in parallel to ensure they'll get queued
nthreads=1 pids=()
nthreads=8 pids=()
ns_per_thread=20
bdev_size=100
blk_size=4096