generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / btrfs / 230
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 230
6 #
7 # Test if btrfs qgroup would crash if we're modifying the fs
8 # after exceeding the limit
9 #
10 . ./common/preamble
11 _begin_fstest auto quick qgroup limit
12
13 # Import common functions.
14 . ./common/filter
15
16 # real QA test starts here
17
18 _supported_fs btrfs
19
20 # This test requires specific data space usage, skip if we have compression
21 # enabled.
22 _require_no_compress
23
24 # Need at least 2GiB
25 _require_scratch_size $((2 * 1024 * 1024))
26 _scratch_mkfs > /dev/null 2>&1
27 _scratch_mount
28
29 _pwrite_byte 0xcd 0 1G $SCRATCH_MNT/file >> $seqres.full
30 # Make sure the data reach disk so later qgroup scan can see it
31 sync
32
33 $BTRFS_UTIL_PROG quota enable $SCRATCH_MNT
34 $BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full
35
36 # Set the limit to just 512MiB, which is way below the existing usage
37 $BTRFS_UTIL_PROG qgroup limit  512M 0/5 $SCRATCH_MNT
38
39 # Touch above file, if kernel not patched, it will trigger an ASSERT()
40 #
41 # Even for patched kernel, we will still get EDQUOT error, but that
42 # is expected behavior.
43 touch $SCRATCH_MNT/file 2>&1 | _filter_scratch
44
45 # success, all done
46 status=0
47 exit