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

tests: added check for kernel version

With older kernels this test can't work reliable,
since 'suspend' used to clean all dirty blocks
(taking even several seconds).
This commit is contained in:
Zdenek Kabelac 2021-03-16 20:54:28 +01:00
parent 8b2cdd8d3a
commit 53bad89a7b

View File

@ -50,14 +50,15 @@ test "$(get lv_field $vg/$lv1 cache_dirty_blocks)" -gt 0 || {
skip "Cannot make a dirty writeback cache LV."
}
LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -v --splitcache $vg/$lv1 >logconvert 2>&1 &
LVM_TEST_TAG="kill_me_$PREFIX" lvconvert -vvvv --splitcache $vg/$lv1 >logconvert 2>&1 &
PID_CONVERT=$!
for i in {1..50}; do
dmsetup table "$vg-$lv1" | grep cleaner && break
test "$i" -ge 100 && die "Waited for cleaner policy on $vg/$lv1 too long!"
echo "Waiting for cleaner policy on $vg/$lv1"
dmsetup table "$vg-$lv1" |& tee out
grep cleaner out && break
echo "$i: Waiting for cleaner policy on $vg/$lv1"
sleep .05
done
test "$i" -ge 49 && die "Waited for cleaner policy on $vg/$lv1 too long!"
# While lvconvert updated table to 'cleaner' policy now it
# should be running in 'Flushing' loop and just 1 KILL should
@ -68,9 +69,16 @@ wait
#cat logconvert || true
# Problem of this test is, in older kernels, even the initial change to cleaner
# policy table line causes long suspend which in practice is cleaning all the
# dirty blocks - so the test can't really break the cache clearing.
#
# So the failure of test is reported only for recent kernels > 5.6
# ans skipped otherwise - as those can't be fixed anyway
grep -E "Flushing.*aborted" logconvert || {
cat logconvert || true
vgremove -f $vg
aux kernel_at_least 5 6 || skip "Cache missed to abort flushing with older kernel"
die "Flushing of $vg/$lv1 not aborted ?"
}