4 # Test log recovery with repeated (simulated) disk failures. We kick
5 # off fsstress on the scratch fs, then switch out the underlying device
6 # with dm-error to see what happens when the disk goes down. Having
7 # taken down the fs in this manner, remount it and repeat. This test
8 # is a Good Enough (tm) simulation of our internal multipath failure
11 #-----------------------------------------------------------------------
12 # Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
14 # This program is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License as
16 # published by the Free Software Foundation.
18 # This program is distributed in the hope that it would be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program; if not, write the Free Software Foundation,
25 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 #-----------------------------------------------------------------------
30 seqres=$RESULT_DIR/$seq
31 echo "QA output created by $seq"
35 status=1 # failure is the default!
36 trap "_cleanup; exit \$status" 0 1 2 3 15
42 $KILLALL_PROG -9 fsstress > /dev/null 2>&1
47 # get standard environment, filters and checks
51 # Modify as appropriate.
56 _require_dm_target error
57 _require_command "$KILLALL_PROG" "killall"
61 echo "Silence is golden."
63 _scratch_mkfs >> $seqres.full 2>&1
64 _require_metadata_journaling $SCRATCH_DEV
68 for i in $(seq 1 $((50 * TIME_FACTOR)) ); do
69 ($FSSTRESS_PROG $FSSTRESS_AVOID -d $SCRATCH_MNT -n 999999 -p $((LOAD_FACTOR * 4)) >> $seqres.full &) \
72 # purposely include 0 second sleeps to test shutdown immediately after
76 # Loading error table without "--nolockfs" option. Because "--nolockfs"
77 # won't freeze fs, then some running I/Os may cause XFS to shutdown
78 # prematurely. That's not what we want to test.
79 _dmerror_load_error_table
81 ps -e | grep fsstress > /dev/null 2>&1
82 while [ $? -eq 0 ]; do
83 $KILLALL_PROG -9 fsstress > /dev/null 2>&1
85 ps -e | grep fsstress > /dev/null 2>&1
88 # Mount again to replay log after loading working table, so we have a
89 # consistent XFS after test.
90 _dmerror_unmount || _fail "unmount failed"
91 _dmerror_load_working_table
92 _dmerror_mount || _fail "mount failed"