mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
btrfs/142: enhance regression test for nocsum dio read's repair
I catch this following error from dmesg when this testcase fails. [17446.661127] Buffer I/O error on dev sdb1, logical block 64, async page read We expect to inject disk IO errors on the device when xfs_io reads the specific file, but other processes may trigger IO error earlier. So, we can use task-filter to solve this problem. Signed-off-by: Lu Fengqi <lufq.fnst@cn.fujitsu.com> Reviewed-by: Eryu Guan <eguan@redhat.com> Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
+11
-8
@@ -75,6 +75,7 @@ start_fail()
|
||||
{
|
||||
echo 100 > $DEBUGFS_MNT/fail_make_request/probability
|
||||
echo 2 > $DEBUGFS_MNT/fail_make_request/times
|
||||
echo 1 > $DEBUGFS_MNT/fail_make_request/task-filter
|
||||
echo 0 > $DEBUGFS_MNT/fail_make_request/verbose
|
||||
echo 1 > $SYSFS_BDEV/make-it-fail
|
||||
}
|
||||
@@ -83,6 +84,7 @@ stop_fail()
|
||||
{
|
||||
echo 0 > $DEBUGFS_MNT/fail_make_request/probability
|
||||
echo 0 > $DEBUGFS_MNT/fail_make_request/times
|
||||
echo 0 > $DEBUGFS_MNT/fail_make_request/task-filter
|
||||
echo 0 > $SYSFS_BDEV/make-it-fail
|
||||
}
|
||||
|
||||
@@ -118,16 +120,17 @@ echo "step 3......repair the bad copy" >>$seqres.full
|
||||
# since raid1 consists of two copies, and the bad copy was put on stripe #1
|
||||
# while the good copy lies on stripe #0, the bad copy only gets access when the
|
||||
# reader's pid % 2 == 1 is true
|
||||
while true; do
|
||||
# start_fail only fails the following dio read so the repair is
|
||||
start_fail
|
||||
while [[ -z ${result} ]]; do
|
||||
# enable task-filter only fails the following dio read so the repair is
|
||||
# supposed to work.
|
||||
start_fail
|
||||
$XFS_IO_PROG -d -c "pread -b 128K 0 128K" "$SCRATCH_MNT/foobar" > /dev/null &
|
||||
pid=$!
|
||||
wait
|
||||
stop_fail
|
||||
[ $((pid % 2)) == 1 ] && break
|
||||
result=$(bash -c "
|
||||
if [[ \$((\$\$ % 2)) -eq 1 ]]; then
|
||||
echo 1 > /proc/\$\$/make-it-fail
|
||||
exec $XFS_IO_PROG -d -c \"pread -b 128K 0 128K\" \"$SCRATCH_MNT/foobar\"
|
||||
fi");
|
||||
done
|
||||
stop_fail
|
||||
|
||||
_scratch_unmount
|
||||
|
||||
|
||||
Reference in New Issue
Block a user