2 # SPDX-License-Identifier: GPL-2.0-or-later
3 # Copyright (c) 2020, Oracle and/or its affiliates. All Rights Reserved.
7 # Tests xfs_growfs on the realtime volume to make sure none of it blows up.
8 # This is a regression test for the following patches:
10 # xfs: Set xfs_buf type flag when growing summary/bitmap files
11 # xfs: Set xfs_buf's b_ops member when zeroing bitmap/summary files
12 # xfs: fix realtime bitmap/summary file truncation when growing rt volume
13 # xfs: make xfs_growfs_rt update secondary superblocks
14 # xfs: annotate grabbing the realtime bitmap/summary locks in growfs
17 seqres=$RESULT_DIR/$seq
18 echo "QA output created by $seq"
22 status=1 # failure is the default!
23 trap "_cleanup; exit \$status" 0 1 2 3 15
28 _scratch_unmount >> $seqres.full 2>&1
29 test -e "$rtdev" && losetup -d $rtdev >> $seqres.full 2>&1
30 rm -f $tmp.* $TEST_DIR/$seq.rtvol
33 # get standard environment, filters and checks
37 # real QA test starts here
39 # Note that we don't _require_realtime because we synthesize a rt volume
41 _require_scratch_nocheck
42 _require_no_large_scratch_dev
44 echo "Create fake rt volume"
45 truncate -s 400m $TEST_DIR/$seq.rtvol
46 rtdev=$(_create_loop_device $TEST_DIR/$seq.rtvol)
48 echo "Format and mount 100m rt volume"
49 export USE_EXTERNAL=yes
50 export SCRATCH_RTDEV=$rtdev
51 _scratch_mkfs -r size=100m > $seqres.full
52 _try_scratch_mount || _notrun "Could not mount scratch with synthetic rt volume"
54 testdir=$SCRATCH_MNT/test-$seq
57 echo "Check rt volume stats"
58 $XFS_IO_PROG -c 'chattr +t' $testdir
59 $XFS_INFO_PROG $SCRATCH_MNT >> $seqres.full
60 before=$(stat -f -c '%b' $testdir)
62 echo "Create some files"
63 _pwrite_byte 0x61 0 1m $testdir/original >> $seqres.full
66 $XFS_GROWFS_PROG $SCRATCH_MNT 2>&1 | _filter_growfs >> $seqres.full
69 echo "Recheck 400m rt volume stats"
70 $XFS_INFO_PROG $SCRATCH_MNT >> $seqres.full
71 after=$(stat -f -c '%b' $testdir)
72 _within_tolerance "rt volume size" $after $((before * 4)) 5% -v
74 echo "Create more copies to make sure the bitmap really works"
75 cp -p $testdir/original $testdir/copy3
77 echo "Check filesystem"