generic: require journal in shutdown tests
[xfstests-dev.git] / tests / generic / 388
1 #! /bin/bash
2 # FS QA Test No. 388
3 #
4 # Test XFS log recovery ordering on v5 superblock filesystems. XFS had a problem
5 # where it would incorrectly replay older modifications from the log over more
6 # recent versions of metadata due to failure to update metadata LSNs during log
7 # recovery. This could result in false positive reports of corruption during log
8 # recovery and permanent mount failure.
9 #
10 # To test this situation, run frequent shutdowns immediately after log recovery.
11 # Ensure that log recovery does not recover stale modifications and cause
12 # spurious corruption reports and/or mount failures.
13 #
14 #-----------------------------------------------------------------------
15 # Copyright (c) 2016 Red Hat, Inc.  All Rights Reserved.
16 #
17 # This program is free software; you can redistribute it and/or
18 # modify it under the terms of the GNU General Public License as
19 # published by the Free Software Foundation.
20 #
21 # This program is distributed in the hope that it would be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24 # GNU General Public License for more details.
25 #
26 # You should have received a copy of the GNU General Public License
27 # along with this program; if not, write the Free Software Foundation,
28 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
29 #-----------------------------------------------------------------------
30 #
31
32 seq=`basename $0`
33 seqres=$RESULT_DIR/$seq
34 echo "QA output created by $seq"
35
36 here=`pwd`
37 tmp=/tmp/$$
38 status=1        # failure is the default!
39 trap "_cleanup; exit \$status" 0 1 2 3 15
40
41 _cleanup()
42 {
43         cd /
44         rm -f $tmp.*
45         $KILLALL_PROG -9 fsstress > /dev/null 2>&1
46         _scratch_unmount > /dev/null 2>&1
47 }
48
49 # get standard environment, filters and checks
50 . ./common/rc
51
52 # Modify as appropriate.
53 _supported_fs generic
54 _supported_os Linux
55
56 _require_scratch
57 _require_scratch_shutdown
58 _require_command "$KILLALL_PROG" "killall"
59
60 rm -f $seqres.full
61
62 echo "Silence is golden."
63
64 _scratch_mkfs >> $seqres.full 2>&1
65 _require_metadata_journaling $SCRATCH_DEV
66 _scratch_mount || _fail "mount failed"
67
68 for i in $(seq 1 50); do
69         ($FSSTRESS_PROG $FSSTRESS_AVOID -d $SCRATCH_MNT -n 999999 -p 4 >> $seqres.full &) \
70                 > /dev/null 2>&1
71
72         # purposely include 0 second sleeps to test shutdown immediately after
73         # recovery
74         sleep $((RANDOM % 3))
75         ./src/godown $SCRATCH_MNT
76
77         ps -e | grep fsstress > /dev/null 2>&1
78         while [ $? -eq 0 ]; do
79                 $KILLALL_PROG -9 fsstress > /dev/null 2>&1
80                 wait > /dev/null 2>&1
81                 ps -e | grep fsstress > /dev/null 2>&1
82         done
83
84         # quit if mount fails so we don't shutdown the host fs
85         _scratch_cycle_mount || _fail "cycle mount failed"
86 done
87
88 # success, all done
89 status=0
90 exit