generic: regression test for ext4 crash consistency bug
[xfstests-dev.git] / tests / generic / 501
1 #! /bin/bash
2 # FS QA Test No. 501
3 #
4 # This test is motivated by a bug found in ext4 during random crash
5 # consistency tests.
6 #
7 #-----------------------------------------------------------------------
8 # Copyright (C) 2017 CTERA Networks. All Rights Reserved.
9 # Author: Amir Goldstein <amir73il@gmail.com>
10 #
11 # This program is free software; you can redistribute it and/or
12 # modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation.
14 #
15 # This program is distributed in the hope that it would be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 # GNU General Public License for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write the Free Software Foundation,
22 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
23 #-----------------------------------------------------------------------
24 #
25
26 seq=`basename $0`
27 seqres=$RESULT_DIR/$seq
28 echo "QA output created by $seq"
29
30 here=`pwd`
31 tmp=/tmp/$$
32 status=1        # failure is the default!
33
34 _cleanup()
35 {
36         _cleanup_flakey
37         cd /
38         rm -f $tmp.*
39 }
40 trap "_cleanup; exit \$status" 0 1 2 3 15
41
42 # get standard environment, filters and checks
43 . ./common/rc
44 . ./common/filter
45 . ./common/dmflakey
46
47 # real QA test starts here
48 _supported_fs generic
49 _supported_os Linux
50 _require_scratch
51 _require_dm_target flakey
52
53 rm -f $seqres.full
54
55 _scratch_mkfs >> $seqres.full 2>&1
56 _require_metadata_journaling $SCRATCH_DEV
57
58 _init_flakey
59 _mount_flakey
60
61 fsxops=$tmp.fsxops
62 cat <<EOF > $fsxops
63 write 0x137dd 0xdc69 0x0
64 fallocate 0xb531 0xb5ad 0x21446
65 collapse_range 0x1c000 0x4000 0x21446
66 write 0x3e5ec 0x1a14 0x21446
67 zero_range 0x20fac 0x6d9c 0x40000 keep_size
68 mapwrite 0x216ad 0x274f 0x40000
69 EOF
70 run_check $here/ltp/fsx -d --replay-ops $fsxops $SCRATCH_MNT/testfile
71
72 _flakey_drop_and_remount
73 _unmount_flakey
74 _cleanup_flakey
75 _check_scratch_fs
76
77 echo "Silence is golden"
78
79 status=0
80 exit