2017-12-13 04:55:06 +03:00
#!/usr/bin/env bash
# Copyright (C) 2017 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA2110-1301 USA
2018-06-01 00:18:53 +03:00
2017-12-13 04:55:06 +03:00
SKIP_WITH_LVMPOLLD = 1
. lib/inittest
# Test reshaping under io load
2018-11-27 14:15:52 +03:00
which md5sum || skip
2017-12-13 04:55:06 +03:00
which mkfs.ext4 || skip
2021-03-23 16:39:13 +03:00
aux have_raid 1 14 || skip
2017-12-13 04:55:06 +03:00
2017-12-13 16:39:06 +03:00
mount_dir = "mnt"
2017-12-13 04:55:06 +03:00
2017-12-13 16:39:06 +03:00
cleanup_mounted_and_teardown( )
{
umount " $mount_dir " || true
aux teardown
}
2017-12-13 04:55:06 +03:00
2018-11-27 14:15:52 +03:00
checksum_( )
{
md5sum " $1 " | cut -f1 -d' '
}
2017-12-13 04:55:06 +03:00
aux prepare_pvs 16 32
get_devs
2018-06-01 00:18:53 +03:00
vgcreate $SHARED -s 1M " $vg " " ${ DEVICES [@] } "
2017-12-13 04:55:06 +03:00
2017-12-13 16:39:06 +03:00
trap 'cleanup_mounted_and_teardown' EXIT
2018-08-31 16:07:24 +03:00
# Create 10-way striped raid5 (11 legs total)
2019-10-31 15:14:50 +03:00
lvcreate --yes --type raid5_ls --stripesize 64K --stripes 10 -L4 -n$lv1 $vg
2017-12-13 04:55:06 +03:00
check lv_first_seg_field $vg /$lv1 segtype "raid5_ls"
check lv_first_seg_field $vg /$lv1 stripesize "64.00k"
check lv_first_seg_field $vg /$lv1 data_stripes 10
check lv_first_seg_field $vg /$lv1 stripes 11
2021-03-22 01:25:16 +03:00
wipefs -a " $DM_DEV_DIR / $vg / $lv1 "
mkfs -t ext4 " $DM_DEV_DIR / $vg / $lv1 "
2017-12-13 04:55:06 +03:00
2018-11-27 14:15:52 +03:00
mkdir -p " $mount_dir "
mount " $DM_DEV_DIR / $vg / $lv1 " " $mount_dir "
2017-12-13 04:55:06 +03:00
echo 3 >/proc/sys/vm/drop_caches
2018-03-13 15:41:33 +03:00
# FIXME: This is filling up ram disk. Use sane amount of data please! Rate limit the data written!
2019-11-15 14:36:39 +03:00
dd if = /dev/urandom of = " $mount_dir /random " bs = 1M count = 4 conv = fdatasync
2018-11-27 14:15:52 +03:00
checksum_ " $mount_dir /random " >MD5
2017-12-13 04:55:06 +03:00
2018-03-13 15:41:33 +03:00
# FIXME: wait_for_sync - is this really testing anything under load?
2017-12-13 04:55:06 +03:00
aux wait_for_sync $vg $lv1
aux delay_dev " $dev2 " 0 200
# Reshape it to 15 data stripes
lvconvert --yes --stripes 15 $vg /$lv1
check lv_first_seg_field $vg /$lv1 segtype "raid5_ls"
check lv_first_seg_field $vg /$lv1 stripesize "64.00k"
check lv_first_seg_field $vg /$lv1 data_stripes 15
check lv_first_seg_field $vg /$lv1 stripes 16
# Reload table during reshape to test for data corruption
2021-03-22 01:25:16 +03:00
case " $( uname -r) " in
2021-04-12 13:04:50 +03:00
5.[ 89] *| 5.1[ 012] .*| 3.10.0-862*| 4.18.0-*.el8*)
2024-04-09 01:33:59 +03:00
echo "Skipping table reload test on on unfixed kernel!!!" ; ;
2021-03-22 01:25:16 +03:00
*)
2017-12-13 04:55:06 +03:00
for i in { 0..5}
do
dmsetup table $vg -$lv1 | dmsetup load $vg -$lv1
dmsetup suspend --noflush $vg -$lv1
dmsetup resume $vg -$lv1
2023-10-20 01:02:44 +03:00
sleep .5
2017-12-13 04:55:06 +03:00
done
2021-03-22 01:25:16 +03:00
esac
2017-12-13 04:55:06 +03:00
aux delay_dev " $dev2 " 0
2018-11-27 14:15:52 +03:00
kill -9 %% || true
2017-12-13 04:55:06 +03:00
wait
2018-11-27 14:15:52 +03:00
checksum_ " $mount_dir /random " >MD5_new
2020-09-10 17:47:52 +03:00
umount " $mount_dir "
2017-12-13 04:55:06 +03:00
fsck -fn " $DM_DEV_DIR / $vg / $lv1 "
2018-11-27 14:15:52 +03:00
# Compare checksum is matching
cat MD5 MD5_new
diff MD5 MD5_new
2017-12-13 04:55:06 +03:00
vgremove -ff $vg