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.
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
50 # Recommended to use MOUNT_OPTIONS="-o compress" to trigger the bug
53 sleep_time=$(($TIME_FACTOR * 30))
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
67 touch $SCRATCH_MNT/testfile
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 &
74 loop_writer 128M 16M $SCRATCH_MNT/testfile &
82 # Wait all writers really exits
83 while ps aux | grep "$SCRATCH_MNT" | grep -qv grep; do
87 echo "Silence is golden"