2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Fujitsu. All Rights Reserved.
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
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
25 kill $pids &> /dev/null
29 # get standard environment, filters and checks
33 # remove previous $seqres.full before test
36 # real QA test starts here
38 # Modify as appropriate.
42 # Use small filesystem to trigger the bug more easily
43 # It's highly recommened to run this test case with MKFS_OPTIONS="-n 64k"
44 # to further increase the possibility
45 # Since the false ENOSPC happens due to incorrect metadata reservation,
46 # larger nodesize and small fs will make it much easier to reproduce
47 _scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seqres.full 2>&1
49 # Recommended to use MOUNT_OPTIONS="-o compress" to trigger the bug
52 sleep_time=$(($TIME_FACTOR * 30))
60 # Only need stderr, and we need to specify small block size
61 # but still large enough trigger compression
62 $XFS_IO_PROG -c "pwrite -b 8K $offset $len" $file > /dev/null
66 touch $SCRATCH_MNT/testfile
68 # Start 2 writter writting into the same file
69 # The file is 142M, which is smaller than 1/2 of the filesystem,
70 # so no other cause can lead to ENOSPC.
71 loop_writer 0 128M $SCRATCH_MNT/testfile &
73 loop_writer 128M 16M $SCRATCH_MNT/testfile &
81 # Wait all writers really exits
82 while ps aux | grep "$SCRATCH_MNT" | grep -qv grep; do
86 echo "Silence is golden"