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

tests: add workaround for older mdadm

Some older instancies of 'mdadm' opened legs in RW and
closed and opened again and expected exlusive access.
But here udev rule can be fired - so on these versions
slow down whole mdadm runtime by using strace, to
give system a bit more time to finish udev rule.
This commit is contained in:
Zdenek Kabelac 2021-03-26 00:35:28 +01:00
parent 0558b223b8
commit 5feb99dda6

View File

@ -27,6 +27,18 @@ _clear_online_files() {
. lib/inittest
which mdadm || skip
STRACE=
[ "$DM_DEV_DIR" = "/dev" ] && mdadm -V 2>&1 | grep " v3.2" && {
# use this 'trick' to slow down mdadm which otherwise
# is racing with udev rule since mdadm internally
# opens and closes raid leg devices in RW mode and then
# tries to get exlusive access to the leg device during
# insertion to kernel and fails during assembly
# There could be more affted version of mdadm.
STRACE="strace -f -o /dev/null"
}
# This stops lvm from taking advantage of hints which
# will have already excluded md components.
@ -109,7 +121,7 @@ test ! -f "$RUNDIR/lvm/vgs_online/$vg"
# should not show an active lv
not dmsetup info $vg-$lv1
mdadm --assemble "$mddev" "$dev1" "$dev2"
$STRACE mdadm --assemble "$mddev" "$dev1" "$dev2"
aux udev_wait
not pvs "$dev1"
@ -264,7 +276,7 @@ test ! -f "$RUNDIR/lvm/vgs_online/$vg"
not dmsetup info $vg-$lv1
# start the md dev
mdadm --assemble "$mddev" "$dev1" "$dev2"
$STRACE mdadm --assemble "$mddev" "$dev1" "$dev2"
aux udev_wait
not pvs "$dev1"