4 # Test XFS EIO error handling configuration. Stop XFS from retrying
5 # to writeback forever when hit EIO.
7 #-----------------------------------------------------------------------
8 # Copyright (c) 2016 Red Hat, Inc. All Rights Reserved.
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU General Public License as
12 # published by the Free Software Foundation.
14 # This program is distributed in the hope that it would be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write the Free Software Foundation,
21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 #-----------------------------------------------------------------------
26 seqres=$RESULT_DIR/$seq
27 echo "QA output created by $seq"
31 status=1 # failure is the default!
32 trap "_cleanup; exit \$status" 0 1 2 3 15
41 # get standard environment, filters and checks
46 # remove previous $seqres.full before test
49 # real QA test starts here
53 _require_dm_target error
54 _require_fs_sysfs error/fail_at_unmount
55 _require_fs_sysfs error/metadata/EIO/max_retries
56 _require_fs_sysfs error/metadata/EIO/retry_timeout_seconds
58 _scratch_mkfs >> $seqres.full 2>&1
67 _reset_xfs_sysfs_error_handling $DMERROR_DEV
68 # Disable fail_at_unmount before test EIO error handling
69 _set_fs_sysfs_attr $DMERROR_DEV error/fail_at_unmount 0
70 echo -n "error/fail_at_unmount="
71 _get_fs_sysfs_attr $DMERROR_DEV error/fail_at_unmount
73 _set_fs_sysfs_attr $DMERROR_DEV $attr 1
74 num=`_get_fs_sysfs_attr $DMERROR_DEV $attr`
76 # _fail the test if we fail to set $attr to 1, because the test
77 # probably will hang in such case and block subsequent tests.
78 if [ "$num" != "1" ]; then
79 _fail "Failed to set $attr: 1"
82 # start a metadata-intensive workload, but no data allocation operation.
83 # Because uncompleted new space allocation I/Os may cause XFS to shutdown
84 # after loading error table.
85 $FSSTRESS_PROG -z -n 5000 -p 10 \
97 -d $SCRATCH_MNT/fsstress >> $seqres.full 2>&1
99 # Loading error table without "--nolockfs" option. Because "--nolockfs"
100 # won't freeze fs, then some running I/Os may cause XFS to shutdown
101 # prematurely. That's not what we want to test.
102 _dmerror_load_error_table lockfs
105 # Mount again to replay log after loading working table, so we have a
106 # consistent XFS after test.
107 _dmerror_load_working_table
112 #### Test EIO/max_retries ####
113 # Set EIO/max_retries a limited number(>-1), then even if fail_at_unmount=0,
114 # the test won't hang.
115 echo "=== Test EIO/max_retries ==="
116 do_test error/metadata/EIO/max_retries
118 #### Test EIO/retry_timeout_seconds ####
119 # Set EIO/retry_timeout_seconds to a limited number(>0), then even if
120 # fail_at_unmount=0, the test won't hang.
121 echo "=== Test EIO/retry_timeout_seconds ==="
122 do_test error/metadata/EIO/retry_timeout_seconds