2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2021 SUSE Linux Products GmbH. All Rights Reserved.
7 # Test that performing io and exhausting qgroup limit won't deadlock. This
8 # exercises issues fixed by the following kernel commits:
10 # 4f6a49de64fd ("btrfs: unlock extents in btrfs_zero_range in case of quota
11 # reservation errors")
12 # 4d14c5cde5c2 ("btrfs: don't flush from btrfs_delayed_inode_reserve_metadata")
15 seqres=$RESULT_DIR/$seq
16 echo "QA output created by $seq"
20 status=1 # failure is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
29 # get standard environment, filters and checks
36 args=`_scale_fsstress_args -p 20 -n 1000 $FSSTRESS_AVOID -d $SCRATCH_MNT/stressdir`
37 $FSSTRESS_PROG $args >/dev/null 2>&1
41 # remove previous $seqres.full before test
44 # real QA test starts here
48 _require_scratch_size $((2 * 1024 * 1024))
49 _scratch_mkfs > /dev/null 2>&1
52 _pwrite_byte 0xcd 0 900m $SCRATCH_MNT/file >> $seqres.full
53 # Make sure the data reach disk so later qgroup scan can see it
56 $BTRFS_UTIL_PROG quota enable $SCRATCH_MNT
57 $BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full
58 # set the limit to 1 g, leaving us just 100mb of slack space
59 $BTRFS_UTIL_PROG qgroup limit 1G 0/5 $SCRATCH_MNT
64 # Give time for the background thread to generate some load
71 echo "Silence is golden"