2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat, Inc. All Rights Reserved.
7 # Test XFS EIO error handling configuration. Stop XFS from retrying
8 # to writeback forever when hit EIO.
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
26 # get standard environment, filters and checks
31 # remove previous $seqres.full before test
34 # real QA test starts here
37 _require_dm_target error
38 _require_fs_sysfs error/fail_at_unmount
39 _require_fs_sysfs error/metadata/EIO/max_retries
40 _require_fs_sysfs error/metadata/EIO/retry_timeout_seconds
42 _scratch_mkfs >> $seqres.full 2>&1
51 _reset_xfs_sysfs_error_handling $DMERROR_DEV
52 # Disable fail_at_unmount before test EIO error handling
53 _set_fs_sysfs_attr $DMERROR_DEV error/fail_at_unmount 0
54 echo -n "error/fail_at_unmount="
55 _get_fs_sysfs_attr $DMERROR_DEV error/fail_at_unmount
57 _set_fs_sysfs_attr $DMERROR_DEV $attr 1
58 num=`_get_fs_sysfs_attr $DMERROR_DEV $attr`
60 # _fail the test if we fail to set $attr to 1, because the test
61 # probably will hang in such case and block subsequent tests.
62 if [ "$num" != "1" ]; then
63 _fail "Failed to set $attr: 1"
66 # start a metadata-intensive workload, but no data allocation operation.
67 # Because uncompleted new space allocation I/Os may cause XFS to shutdown
68 # after loading error table.
69 $FSSTRESS_PROG -z -n 5000 -p 10 \
81 -d $SCRATCH_MNT/fsstress >> $seqres.full 2>&1
83 # Loading error table without "--nolockfs" option. Because "--nolockfs"
84 # won't freeze fs, then some running I/Os may cause XFS to shutdown
85 # prematurely. That's not what we want to test.
86 _dmerror_load_error_table lockfs
89 # Mount again to replay log after loading working table, so we have a
90 # consistent XFS after test.
91 _dmerror_load_working_table
96 #### Test EIO/max_retries ####
97 # Set EIO/max_retries a limited number(>-1), then even if fail_at_unmount=0,
98 # the test won't hang.
99 echo "=== Test EIO/max_retries ==="
100 do_test error/metadata/EIO/max_retries
102 #### Test EIO/retry_timeout_seconds ####
103 # Set EIO/retry_timeout_seconds to a limited number(>0), then even if
104 # fail_at_unmount=0, the test won't hang.
105 echo "=== Test EIO/retry_timeout_seconds ==="
106 do_test error/metadata/EIO/retry_timeout_seconds