From 2d6acbaee42267f8c7e32ad6db2dcc8abc9df4df Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Tue, 5 Apr 2022 20:48:30 +0800 Subject: [PATCH] btrfs-progs: tests/fsck: add test case for data csum check on raid5 Previously 'btrfs check --check-data-csum' will report tons of false alerts for RAID56. Add a test case to make sure with the new RAID56 rebuild ability, there should be no false alerts. Signed-off-by: Qu Wenruo Signed-off-by: David Sterba --- .../056-raid56-false-alerts/test.sh | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 tests/fsck-tests/056-raid56-false-alerts/test.sh diff --git a/tests/fsck-tests/056-raid56-false-alerts/test.sh b/tests/fsck-tests/056-raid56-false-alerts/test.sh new file mode 100755 index 00000000..6efb5c00 --- /dev/null +++ b/tests/fsck-tests/056-raid56-false-alerts/test.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# +# Make sure "btrfs check --check-data-csum" won't report false alerts on RAID56 +# data. +# + +source "$TEST_TOP/common" + +check_prereq btrfs +check_prereq mkfs.btrfs +check_global_prereq losetup + +setup_loopdevs 3 +prepare_loopdevs +dev1=${loopdevs[1]} +TEST_DEV=$dev1 + +setup_root_helper + +run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f -m raid1 -d raid5 "${loopdevs[@]}" +run_check_mount_test_dev + +run_check $SUDO_HELPER dd if=/dev/urandom of="$TEST_MNT/file" bs=16K count=1 \ + status=noxfer > /dev/null 2>&1 + +run_check_umount_test_dev + +# Check data csum should not report false alerts +run_check "$TOP/btrfs" check --check-data-csum "$dev1" + +cleanup_loopdevs