From 0a845fec275c8ca761d265f22bfabdcfab85e68f Mon Sep 17 00:00:00 2001 From: Michal Berger Date: Wed, 12 Apr 2023 09:42:22 +0200 Subject: [PATCH] test/vhost: Create wrapper around wipefs Call sync each time, as an extra step, to make sure all the writes on the underlying device completed. This is needed, as on occasion parted (called right after wipefs) fails to create pt complaining that the target device (and its partitions) are still in use. Change-Id: I959d9b36a1588ec3754335995e3e8bc5057bfeb7 Signed-off-by: Michal Berger Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17498 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Konrad Sztyber --- test/vhost/integrity/integrity_vm.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/vhost/integrity/integrity_vm.sh b/test/vhost/integrity/integrity_vm.sh index cf170d998..3010f1605 100755 --- a/test/vhost/integrity/integrity_vm.sh +++ b/test/vhost/integrity/integrity_vm.sh @@ -5,6 +5,11 @@ # set -xe +wipe() { + wipefs --all --force "$@" + sync +} + cleanup() { local _devs=() @@ -13,7 +18,7 @@ cleanup() { _devs=("${devs[@]/#//dev/}") umount "${_devs[@]}" || : - wipefs --all --force "${_devs[@]}" || : + wipe "${_devs[@]}" || : } MAKE="make -j$(($(nproc) * 2))" @@ -37,11 +42,11 @@ trap "cleanup; exit 1" SIGINT SIGTERM EXIT for fs in $fs; do for dev in "${devs[@]}"; do [[ -b /dev/$dev ]] - wipefs --all --force "/dev/$dev" + wipe "/dev/$dev" echo "INFO: Creating partition table on $dev disk" parted "/dev/$dev" -s mklabel gpt mkpart SPDK_TEST 2048s 100% sleep 1s - wipefs --all --force "/dev/${dev}1" + wipe "/dev/${dev}1" echo "INFO: Creating filesystem on /dev/${dev}1" if [[ $fs == ext4 ]]; then