xfs/{263,106}: erase max warnings printout
[xfstests-dev.git] / tests / btrfs / 132
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Fujitsu.  All Rights Reserved.
4 #
5 # FS QA Test 132
6 #
7 # Check if false ENOSPC will happen when parallel buffer write happens
8 # The problem is caused by incorrect metadata reservation for any buffered
9 # write whose max extent size is not 128M (including compression and in-band
10 # dedupe).
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         kill $pids &> /dev/null
26         wait
27 }
28
29 # get standard environment, filters and checks
30 . ./common/rc
31 . ./common/filter
32
33 # remove previous $seqres.full before test
34 rm -f $seqres.full
35
36 # real QA test starts here
37
38 # Modify as appropriate.
39 _supported_fs btrfs
40 _supported_os Linux
41 _require_scratch
42
43 # Use small filesystem to trigger the bug more easily
44 # It's highly recommened to run this test case with MKFS_OPTIONS="-n 64k"
45 # to further increase the possibility
46 # Since the false ENOSPC happens due to incorrect metadata reservation,
47 # larger nodesize and small fs will make it much easier to reproduce
48 _scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seqres.full 2>&1
49
50 # Recommended to use MOUNT_OPTIONS="-o compress" to trigger the bug
51 _scratch_mount
52
53 sleep_time=$(($TIME_FACTOR * 30))
54 loop_writer()
55 {
56         offset=$1
57         len=$2
58         file=$3
59
60         while true; do
61                 # Only need stderr, and we need to specify small block size
62                 # but still large enough trigger compression
63                 $XFS_IO_PROG -c "pwrite -b 8K $offset $len" $file > /dev/null
64         done
65 }
66
67 touch $SCRATCH_MNT/testfile
68
69 # Start 2 writter writting into the same file
70 # The file is 142M, which is smaller than 1/2 of the filesystem,
71 # so no other cause can lead to ENOSPC.
72 loop_writer 0 128M $SCRATCH_MNT/testfile &
73 pids=$!
74 loop_writer 128M 16M $SCRATCH_MNT/testfile &
75 pids="$pids $!"
76
77 sleep $sleep_time
78
79 kill $pids
80 wait
81
82 # Wait all writers really exits
83 while ps aux | grep "$SCRATCH_MNT" | grep -qv grep; do
84         sleep 1
85 done
86
87 echo "Silence is golden"
88 status=0
89 exit