fsx/fsstress: round blocksize properly
[xfstests-dev.git] / tests / ext4 / 025
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Fujitsu.  All Rights Reserved.
4 #
5 # FS QA Test ext4/025
6 #
7 # Regression test for commit:
8 # 3a4b77c ("ext4: validate s_first_meta_bg at mount time").
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20         rm -f $tmp.*
21 }
22
23 # get standard environment and checks
24 . ./common/rc
25 . ./common/filter
26
27 # remove previous $seqres.full before test
28 rm -f $seqres.full
29
30 # real QA test starts here
31 _supported_fs ext4
32 _require_scratch_nocheck
33 _require_command "$DEBUGFS_PROG" debugfs
34 _require_scratch_ext4_feature "bigalloc,meta_bg,^resize_inode"
35
36 echo "Create ext4 fs and modify first_meta_bg's value"
37 _scratch_mkfs "-O bigalloc,meta_bg,^resize_inode" >> $seqres.full 2>&1
38
39 # set a big enough first_meta_bg to trigger buffer overrun
40 # 842150400 is from original fuzzed ext4 image in bug report
41 $DEBUGFS_PROG -w -R "ssv first_meta_bg 842150400" $SCRATCH_DEV >> $seqres.full 2>&1
42
43 echo "Try to mount a modified ext4 fs"
44 _try_scratch_mount >> $seqres.full 2>&1 || echo "Fail to mount ext4 fs expectedly"
45
46 # success, all done
47 status=0
48 exit