xfs/004: don't fail test due to realtime files
[xfstests-dev.git] / tests / xfs / 423
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Oracle, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 423
6 #
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.
11 #
12 seq=`basename $0`
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 7 15
20
21 _cleanup()
22 {
23         cd /
24         rm -rf $tmp.*
25 }
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/filter
30 . ./common/fuzzy
31 . ./common/inject
32 . ./common/xfs
33
34 # real QA test starts here
35 _supported_fs xfs
36 _require_test_program "punch-alternating"
37 _require_xfs_io_command "scrub"
38 _require_xfs_io_command "falloc"
39 _require_scratch
40
41 echo "Format and populate"
42 _scratch_mkfs > "$seqres.full" 2>&1
43 _scratch_mount
44
45 $XFS_IO_PROG -f -c 'falloc 0 10m' $SCRATCH_MNT/a >> $seqres.full
46 $XFS_IO_PROG -f -c 'falloc 0 10m' $SCRATCH_MNT/b >> $seqres.full
47 $here/src/punch-alternating $SCRATCH_MNT/b
48 sync
49
50 echo "Set up delalloc extents"
51 $XFS_IO_PROG -c 'pwrite -S 0x66 10m 128k' $SCRATCH_MNT/a >> $seqres.full
52 $XFS_IO_PROG -c 'pwrite -S 0x66 10m 128k' $SCRATCH_MNT/b >> $seqres.full
53 $XFS_IO_PROG -c 'bmap -ev' $SCRATCH_MNT/a $SCRATCH_MNT/b > $SCRATCH_MNT/before
54 cat $SCRATCH_MNT/before >> $seqres.full
55
56 echo "Scrub a and b"
57 $XFS_IO_PROG -x -c 'scrub inode' $SCRATCH_MNT/a >> $seqres.full
58 $XFS_IO_PROG -x -c 'scrub inode' $SCRATCH_MNT/b >> $seqres.full
59 $XFS_IO_PROG -c 'bmap -ev' $SCRATCH_MNT/a $SCRATCH_MNT/b > $SCRATCH_MNT/after
60 cat $SCRATCH_MNT/after >> $seqres.full
61
62 echo "Compare extent maps"
63 diff -u $SCRATCH_MNT/before $SCRATCH_MNT/after
64
65 echo "Test done"
66 status=0
67 exit