1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

tests: wipefs with udev_wait

Try to synchronize with colliding udev.
Also retry once if there is some failure with some
sleep between next retry.

Use oflag=direct for wipping without wipefs.
This commit is contained in:
Zdenek Kabelac 2021-03-23 14:57:10 +01:00
parent 14a3c34983
commit 93f2d194ac

View File

@ -818,10 +818,16 @@ wipefs_a() {
echo "$have_wipefs" > HAVE_WIPEFS
fi
udev_wait
if [ "$have_wipefs" = "1" ] ; then
wipefs -a "$dev"
wipefs -a "$dev" || {
echo "$dev: device in-use, retrying wipe again."
sleep 1
udev_wait
wipefs -a "$dev"
}
else
dd if=/dev/zero of="$dev" bs=4096 count=8 >/dev/null || true
dd if=/dev/zero of="$dev" bs=4096 count=8 oflag=direct >/dev/null || true
mdadm --zero-superblock "$dev" 2>/dev/null || true
fi