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 _begin_fstest dangerous_scrub
15 _register_cleanup "_cleanup" BUS
17 # Import common functions.
23 # real QA test starts here
25 _require_test_program "punch-alternating"
26 _require_xfs_io_command "scrub"
27 _require_xfs_io_command "falloc"
30 echo "Format and populate"
31 _scratch_mkfs > "$seqres.full" 2>&1
34 $XFS_IO_PROG -f -c 'falloc 0 10m' $SCRATCH_MNT/a >> $seqres.full
35 $XFS_IO_PROG -f -c 'falloc 0 10m' $SCRATCH_MNT/b >> $seqres.full
36 $here/src/punch-alternating $SCRATCH_MNT/b
39 echo "Set up delalloc extents"
40 $XFS_IO_PROG -c 'pwrite -S 0x66 10m 128k' $SCRATCH_MNT/a >> $seqres.full
41 $XFS_IO_PROG -c 'pwrite -S 0x66 10m 128k' $SCRATCH_MNT/b >> $seqres.full
42 $XFS_IO_PROG -c 'bmap -ev' $SCRATCH_MNT/a $SCRATCH_MNT/b > $SCRATCH_MNT/before
43 cat $SCRATCH_MNT/before >> $seqres.full
46 $XFS_IO_PROG -x -c 'scrub inode' $SCRATCH_MNT/a >> $seqres.full
47 $XFS_IO_PROG -x -c 'scrub inode' $SCRATCH_MNT/b >> $seqres.full
48 $XFS_IO_PROG -c 'bmap -ev' $SCRATCH_MNT/a $SCRATCH_MNT/b > $SCRATCH_MNT/after
49 cat $SCRATCH_MNT/after >> $seqres.full
51 echo "Compare extent maps"
52 diff -u $SCRATCH_MNT/before $SCRATCH_MNT/after