2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
7 # Race scrubbing the inode record while appending to a file.
8 # This exposes a bug in xfs_bmap_count_blocks where we count delalloc
9 # extents for di_nblocks if the fork is in extents format, but we don't
10 # count them if the fork is in btree format.
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 7 15
27 # get standard environment, filters and checks
34 # real QA test starts here
36 _require_test_program "punch-alternating"
37 _require_xfs_io_command "scrub"
40 echo "Format and populate"
41 _scratch_mkfs > "$seqres.full" 2>&1
44 $XFS_IO_PROG -f -c 'falloc 0 10m' $SCRATCH_MNT/a >> $seqres.full
45 $XFS_IO_PROG -f -c 'falloc 0 10m' $SCRATCH_MNT/b >> $seqres.full
46 $here/src/punch-alternating $SCRATCH_MNT/b
49 echo "Set up delalloc extents"
50 $XFS_IO_PROG -c 'pwrite -S 0x66 10m 128k' $SCRATCH_MNT/a >> $seqres.full
51 $XFS_IO_PROG -c 'pwrite -S 0x66 10m 128k' $SCRATCH_MNT/b >> $seqres.full
52 $XFS_IO_PROG -c 'bmap -ev' $SCRATCH_MNT/a $SCRATCH_MNT/b > $SCRATCH_MNT/before
53 cat $SCRATCH_MNT/before >> $seqres.full
56 $XFS_IO_PROG -x -c 'scrub inode' $SCRATCH_MNT/a >> $seqres.full
57 $XFS_IO_PROG -x -c 'scrub inode' $SCRATCH_MNT/b >> $seqres.full
58 $XFS_IO_PROG -c 'bmap -ev' $SCRATCH_MNT/a $SCRATCH_MNT/b > $SCRATCH_MNT/after
59 cat $SCRATCH_MNT/after >> $seqres.full
61 echo "Compare extent maps"
62 diff -u $SCRATCH_MNT/before $SCRATCH_MNT/after