fsx/fsstress: round blocksize properly
[xfstests-dev.git] / tests / ext4 / 030
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017-2018 Intel Corporation.  All Rights Reserved.
4 #
5 # FS QA Test ext4/030
6 #
7 # This is a regression test for kernel patch:
8 #   ext4: prevent data corruption with journaling + DAX
9 # created by Ross Zwisler <ross.zwisler@linux.intel.com>
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
19
20 _cleanup()
21 {
22         cd /
23         rm -f $tmp.*
24 }
25
26 # get standard environment, filters and checks
27 . ./common/rc
28 . ./common/filter
29
30 # remove previous $seqres.full before test
31 rm -f $seqres.full
32
33 # Modify as appropriate.
34 _supported_fs ext4
35 _require_scratch_dax_mountopt "dax"
36 _require_test_program "t_ext4_dax_journal_corruption"
37 _require_command "$CHATTR_PROG" chattr
38
39 # real QA test starts here
40 _scratch_mkfs > $seqres.full 2>&1
41
42 # In order to get our failure condition consistently we need to turn off
43 # delayed allocation.  With delayed allocation on this simple test will pass,
44 # but we would almost certainly see data corruption down the road as the
45 # contents of the journal would conflict with the DAX data.
46 _scratch_mount "-o dax,nodelalloc" >> $seqres.full 2>&1
47
48 $here/src/t_ext4_dax_journal_corruption $CHATTR_PROG $SCRATCH_MNT/testfile
49
50 if [[ $? != 0 && $? != 77 ]]; then
51         echo "Test failed, status $?"
52         exit 1
53 fi
54
55 # success, all done
56 echo "Silence is golden"
57 status=0
58 exit