Commit d8f50cfb authored by Michal Berger's avatar Michal Berger Committed by Konrad Sztyber
Browse files

test/bdev: Wait for capacity change after starting nbd disk



Under fedora40, which is shipped with latest 6.10 kernel build, the
bdev_nbd test introduces a new intermittent failure - when the mkfs is
called against the target nbd device, right after nbd_start_disk(), it
fails reporting the size of underlying device being 0. This is then
followed by -EPIPE while reading the reply from the device:

block nbd0: Receive control failed (result -32)

This is kernel essentially telling us that there was no proper request
to disconnect the device either.

To mitigate, wait until setting up the nbd device completed by
checking change in capacity.

Signed-off-by: default avatarMichal Berger <michal.berger@intel.com>
Change-Id: I0233785ac4e1cb42d85a3a071d6cc32e702fbfa1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/24787


Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
parent 52af6468
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -136,6 +136,18 @@ function nbd_with_lvol_verify() {
	$rootdir/scripts/rpc.py -s $rpc_server bdev_lvol_create lvol 4 -l lvs
	$rootdir/scripts/rpc.py -s $rpc_server nbd_start_disk lvs/lvol "$nbd"

	wait_for_nbd_set_capacity "$nbd"

	mkfs.ext4 "$nbd"
	nbd_stop_disks $rpc_server "$nbd"
}

function wait_for_nbd_set_capacity() {
	local nbd=${1##*/}

	[[ -e /sys/block/$nbd/size ]] || return 1

	while (($(< "/sys/block/$nbd/size") == 0)); do
		sleep 0.1
	done
}