btrfs/210: Ignore output from "quota rescan" after "quota enable"
[xfstests-dev.git] / tests / btrfs / 210
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2020 SUSE Linux Products GmbH. All Rights Reserved.
4 #
5 # FS QA Test 210
6 #
7 # Test that a new snapshot created with qgroup inherit passed should mark
8 # qgroup numbers inconsistent.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 status=1        # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21         cd /
22         rm -f $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28
29 # remove previous $seqres.full before test
30 rm -f $seqres.full
31
32 # real QA test starts here
33
34 # Modify as appropriate.
35 _supported_fs btrfs
36 _supported_os Linux
37 _require_scratch
38
39 _scratch_mkfs >/dev/null
40 _scratch_mount
41
42 $BTRFS_UTIL_PROG subvolume create "$SCRATCH_MNT/src" > /dev/null
43 _pwrite_byte 0xcd 0 16M "$SCRATCH_MNT/src/file" > /dev/null
44
45 # Sync the fs to ensure data written to disk so that they can be accounted
46 # by qgroup
47 sync
48 $BTRFS_UTIL_PROG quota enable "$SCRATCH_MNT"
49 $BTRFS_UTIL_PROG quota rescan -w "$SCRATCH_MNT" > /dev/null
50 $BTRFS_UTIL_PROG qgroup create 1/0 "$SCRATCH_MNT"
51
52 # Create a snapshot with qgroup inherit
53 $BTRFS_UTIL_PROG subvolume snapshot -i 1/0 "$SCRATCH_MNT/src" \
54         "$SCRATCH_MNT/snapshot" > /dev/null
55
56 echo "Silence is golden"
57 # If qgroup is not marked inconsistent automatically, btrfs check would
58 # report error.
59
60 # success, all done
61 status=0
62 exit