Commit ab0a3f8f authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

nvmf: do not pause a namespace when resizing



SPDK block devices can only be resized up when
it is open. So there is no need to pause the
associated namespace itself when resized - just
pausing the subsystem is enough.

Also modify the ns_hotplug_test to do null bdev
resizing - this will help test this resize code path.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I3cb7b9de0892c296f2abf2280bed434d18ebe6b5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6467


Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatar <dongx.yi@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent d90a5511
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1298,7 +1298,10 @@ nvmf_ns_resize(void *event_ctx)
	ns_ctx->nsid = ns->opts.nsid;
	ns_ctx->cb_fn = _nvmf_ns_resize;

	rc = spdk_nvmf_subsystem_pause(ns->subsystem, ns_ctx->nsid, _nvmf_ns_resize, ns_ctx);
	/* Specify 0 for the nsid here, because we do not need to pause the namespace.
	 * Namespaces can only be resized bigger, so there is no need to quiesce I/O.
	 */
	rc = spdk_nvmf_subsystem_pause(ns->subsystem, 0, _nvmf_ns_resize, ns_ctx);
	if (rc) {
		if (rc == -EBUSY) {
			/* Try again, this is not a permanent situation. */
+7 −1
Original line number Diff line number Diff line
@@ -10,6 +10,8 @@ rpc_py="$rootdir/scripts/rpc.py"
nvmftestinit
nvmfappstart -m 0xE

null_size=1000

$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192

$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s SPDK00000000000001 -m 10
@@ -17,7 +19,7 @@ $rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPOR
$rpc_py bdev_malloc_create 32 512 -b Malloc0
$rpc_py bdev_delay_create -b Malloc0 -d Delay0 -r 1000000 -t 1000000 -w 1000000 -n 1000000
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Delay0
$rpc_py bdev_null_create NULL1 1000 512
$rpc_py bdev_null_create NULL1 $null_size 512
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 NULL1

# Note: use -Q option to rate limit the error messages that perf will spew due to the
@@ -29,6 +31,10 @@ PERF_PID=$!
while kill -0 $PERF_PID; do
	$rpc_py nvmf_subsystem_remove_ns nqn.2016-06.io.spdk:cnode1 1
	$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Delay0
	# Also test bdev/namespace resizing here, since it has a similar
	# effect on subsystem/namespace handling in the nvmf target
	null_size=$((null_size + 1))
	$rpc_py bdev_null_resize NULL1 $null_size
done

wait $PERF_PID