Commit bc9423e2 authored by suman chakraborty's avatar suman chakraborty Committed by Daniel Verkamp
Browse files

Segfault occurs during connect to the subsystem when a namespace is added with...


Segfault occurs during connect to the subsystem when a namespace is added with a nsid smaller than the nsid previously added

Change-Id: I74c7b32e1713d683e5d80818724ed3b19f3dac64
Signed-off-by: default avatarsuman chakraborty <suman.chakraborty@wdc.com>
Reviewed-on: https://review.gerrithub.io/405373


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent af7cbd44
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -455,7 +455,13 @@ poll_group_update_subsystem(struct spdk_nvmf_poll_group *group,
	old_num_channels = sgroup->num_channels;

	if (new_num_channels == old_num_channels) {
		/* Nothing to do */
		/* Initialize new channels */
		for (i = 0; i < new_num_channels; i++) {
			ns = subsystem->ns[i];
			if ((ns != NULL) && (sgroup->channels[i] == NULL)) {
				sgroup->channels[i] = spdk_bdev_get_io_channel(ns->desc);
			}
		}
	} else if (old_num_channels == 0) {
		/* First allocation */
		sgroup->channels = calloc(new_num_channels, sizeof(sgroup->channels[0]));
+35 −0
Original line number Diff line number Diff line
@@ -68,6 +68,41 @@ nvme connect -t rdma -n nqn.2016-06.io.spdk:cnode1 -q nqn.2016-06.io.spdk:host1
nvme disconnect -n nqn.2016-06.io.spdk:cnode1

$rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1

# do frequent add delete of namespaces with different nsid.
for i in `seq 1 $times`
do
	j=0
	for bdev in $bdevs; do
		let j=j+1
		$rpc_py construct_nvmf_subsystem nqn.2016-06.io.spdk:cnode$j '' '' -s SPDK00000000000001
		$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode$j $bdev -n 10
		$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode$j $bdev -n 5
		$rpc_py nvmf_subsystem_allow_any_host nqn.2016-06.io.spdk:cnode$j
		nvme connect -t rdma -n nqn.2016-06.io.spdk:cnode$j -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
	done

	n=$j
	for j in `seq 1 $n`
	do
		nvme disconnect -n nqn.2016-06.io.spdk:cnode$j
	done

	j=0
	for bdev in $bdevs; do
		let j=j+1
		$rpc_py nvmf_subsystem_remove_ns nqn.2016-06.io.spdk:cnode$j 10
		$rpc_py nvmf_subsystem_remove_ns nqn.2016-06.io.spdk:cnode$j 5
	done

	n=$j
	for j in `seq 1 $n`
	do
		$rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode$j
	done

done

nvmfcleanup
trap "killprocess $pid; exit 1" SIGINT SIGTERM EXIT