generic/233,270: unlimit the max locked memory size for io_uring
[xfstests-dev.git] / tests / btrfs / 217
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 217
6 #
7 # Test if the following workload would cause problem:
8 # - fstrim
9 # - shrink device
10 # - fstrim
11 #
12 seq=`basename $0`
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
20
21 _cleanup()
22 {
23         cd /
24         rm -f $tmp.*
25 }
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/filter
30
31 # remove previous $seqres.full before test
32 rm -f $seqres.full
33
34 # real QA test starts here
35
36 # Modify as appropriate.
37 _supported_fs btrfs
38 _require_scratch_size $((5 * 1024 * 1024)) #kB
39 _require_fstrim
40
41 # Create a 5G fs
42 _scratch_mkfs_sized $((5 * 1024 * 1024 * 1024)) >> $seqres.full
43 _scratch_mount
44
45 # Fstrim to populate the device->alloc_status CHUNK_TRIMMED bits
46 $FSTRIM_PROG -v $SCRATCH_MNT >> $seqres.full 2>&1 || \
47         _notrun "FSTRIM not supported"
48
49
50 # Shrink the fs to 4G, so the existing CHUNK_TRIMMED bits are beyond
51 # device boundary
52 $BTRFS_UTIL_PROG filesystem resize 1:-1G "$SCRATCH_MNT" >> $seqres.full
53
54 # Do fstrim again to trigger the bug
55 $FSTRIM_PROG -v $SCRATCH_MNT >> $seqres.full
56
57 echo "Silence is golden"
58
59 # success, all done
60 status=0
61 exit