common/fuzzy: try to clear blocking flags first in _scratch_fuzz_modify
[xfstests-dev.git] / tests / ext4 / 306
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. ext4/306
6 #
7 # Test that blocks are available to non-extent files after a resize2fs
8 # Regression test for commit:
9 # c5c72d8 ext4: fix online resizing for ext3-compat file systems
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 PIDS=""
16 status=1        # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21     _scratch_unmount
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27
28 # real QA test starts here
29 _supported_fs ext4
30 _supported_os Linux
31
32 _require_scratch
33 _require_command "$RESIZE2FS_PROG" resize2fs
34
35 rm -f $seqres.full
36
37 # Make a small ext4 fs with extents disabled & mount it
38 features="^extents"
39 if grep -q 64bit /etc/mke2fs.conf ; then
40     features="^extents,^64bit"
41 fi
42 $MKFS_EXT4_PROG -F -O "$features" $SCRATCH_DEV 512m >> $seqres.full 2>&1
43 _scratch_mount
44
45 # Create a small non-extent-based file
46 echo "Create 1m testfile1"
47 $XFS_IO_PROG -f $SCRATCH_MNT/testfile1 -c "pwrite 0 1m" | _filter_xfs_io
48
49 # Create a large non-extent-based file filling the fs; this will run out & fail
50 echo "Create testfile2 to fill the fs"
51 $XFS_IO_PROG -f $SCRATCH_MNT/testfile2 -c "pwrite 0 512m" 2>&1 | \
52         _filter_xfs_io_error
53 df -h $SCRATCH_MNT >> $seqres.full
54
55 # Grow fs by 512m
56 echo "Resize to 1g"
57 $RESIZE2FS_PROG $SCRATCH_DEV 1g >> $seqres.full 2>&1 || _fail "Could not resize to 1g"
58 df -h $SCRATCH_MNT >> $seqres.full
59
60 # See if we can add more blocks to the files
61 echo "append 2m to testfile1"
62 $XFS_IO_PROG -f $SCRATCH_MNT/testfile1 -c "pwrite 1m 2m" | _filter_xfs_io
63 echo "append 2m to testfile2"
64 $XFS_IO_PROG -f $SCRATCH_MNT/testfile1 -c "pwrite 512m 2m" | _filter_xfs_io
65
66 status=0
67 exit