2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2020 SUSE Linux Products GmbH. All Rights Reserved.
7 # Test if btrfs qgroup would crash if we're modifying the fs
8 # after exceeding the limit
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
16 status=1 # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
25 # get standard environment, filters and checks
29 # remove previous $seqres.full before test
32 # real QA test starts here
37 _require_scratch_size $((2 * 1024 * 1024))
38 _scratch_mkfs > /dev/null 2>&1
41 _pwrite_byte 0xcd 0 1G $SCRATCH_MNT/file >> $seqres.full
42 # Make sure the data reach disk so later qgroup scan can see it
45 $BTRFS_UTIL_PROG quota enable $SCRATCH_MNT
46 $BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full
48 # Set the limit to just 512MiB, which is way below the existing usage
49 $BTRFS_UTIL_PROG qgroup limit 512M 0/5 $SCRATCH_MNT
51 # Touch above file, if kernel not patched, it will trigger an ASSERT()
53 # Even for patched kernel, we will still get EDQUOT error, but that
54 # is expected behavior.
55 touch $SCRATCH_MNT/file 2>&1 | _filter_scratch