xfs/{263,106}: erase max warnings printout
[xfstests-dev.git] / tests / btrfs / 058
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2014 SUSE Linux Products GmbH. All Rights Reserved.
4 #
5 # FS QA Test No. btrfs/058
6 #
7 # Regression test for a btrfs issue where we create a RO snapshot to use for
8 # a send operation which fails with a -ESTALE error, due to the presence of
9 # orphan inodes accessible through the snapshot's commit root but no longer
10 # present through the main root.
11 #
12 # This issue is fixed by the following linux kernel btrfs patch:
13 #
14 #    Btrfs: update commit root on snapshot creation after orphan cleanup
15 #
16 seq=`basename $0`
17 seqres=$RESULT_DIR/$seq
18 echo "QA output created by $seq"
19
20 tmp=/tmp/$$
21 status=1        # failure is the default!
22 trap "_cleanup; exit \$status" 0 1 2 3 15
23
24 _cleanup()
25 {
26         if [ ! -z $XFS_IO_PID ]; then
27                 kill $XFS_IO_PID > /dev/null 2>&1
28         fi
29         rm -fr $tmp
30 }
31
32 # get standard environment, filters and checks
33 . ./common/rc
34 . ./common/filter
35
36 # real QA test starts here
37 _supported_fs btrfs
38 _supported_os Linux
39 _require_scratch
40 _require_xfs_io_command "-T"
41
42 rm -f $seqres.full
43
44 _scratch_mkfs >/dev/null 2>&1
45 _scratch_mount
46
47 # Create a tmpfile file, write some data to it and leave it open, so that our
48 # main subvolume has an orphan inode item.
49 $XFS_IO_PROG -T $SCRATCH_MNT >>$seqres.full 2>&1 < <(
50         echo "pwrite 0 65536"
51         read
52 ) &
53 XFS_IO_PID=$!
54
55 # Give it some time to the xfs_io process to create the tmpfile.
56 sleep 3
57
58 # With the tmpfile open, create a RO snapshot and use it for a send operation.
59 # The send operation used to fail with -ESTALE due to the presence of the
60 # orphan inode.
61 _run_btrfs_util_prog subvolume snapshot -r $SCRATCH_MNT $SCRATCH_MNT/mysnap
62 _run_btrfs_util_prog send -f /dev/null $SCRATCH_MNT/mysnap
63
64 status=0
65 exit