4 # Check if false ENOSPC will happen when parallel buffer write happens
5 # The problem is caused by incorrect metadata reservation for any buffered
6 # write whose max extent size is not 128M (including compression and in-band
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2016 Fujitsu. All Rights Reserved.
12 # This program is free software; you can redistribute it and/or
13 # modify it under the terms of the GNU General Public License as
14 # published by the Free Software Foundation.
16 # This program is distributed in the hope that it would be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program; if not, write the Free Software Foundation,
23 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #-----------------------------------------------------------------------
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
33 status=1 # failure is the default!
34 trap "_cleanup; exit \$status" 0 1 2 3 15
40 kill $pids &> /dev/null
44 # get standard environment, filters and checks
48 # remove previous $seqres.full before test
51 # real QA test starts here
53 # Modify as appropriate.
58 # Use small filesystem to trigger the bug more easily
59 # It's highly recommened to run this test case with MKFS_OPTIONS="-n 64k"
60 # to further increase the possibility
61 # Since the false ENOSPC happens due to incorrect metadata reservation,
62 # larger nodesize and small fs will make it much easier to reproduce
63 _scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seqres.full 2>&1
65 # Recommended to use MOUNT_OPTIONS="-o compress" to trigger the bug
68 sleep_time=$(($TIME_FACTOR * 30))
76 # Only need stderr, and we need to specify small block size
77 # but still large enough trigger compression
78 $XFS_IO_PROG -c "pwrite -b 8K $offset $len" $file > /dev/null
82 touch $SCRATCH_MNT/testfile
84 # Start 2 writter writting into the same file
85 # The file is 142M, which is smaller than 1/2 of the filesystem,
86 # so no other cause can lead to ENOSPC.
87 loop_writer 0 128M $SCRATCH_MNT/testfile &
89 loop_writer 128M 16M $SCRATCH_MNT/testfile &
97 # Sync the fs to avoid EBUSY while umount, which is quite common for btrfs
101 echo "Silence is golden"