tests: remove udf/101
[xfstests-dev.git] / tests / generic / 072
1 #! /bin/bash
2 # FS QA Test No. 072
3 #
4 # Test truncate/collapse range race.
5 # And this test is also a regression test for kernel commit 23fffa9,
6 #    fs: move falloc collapse range check into the filesystem methods
7 # If the race occurs, it will trigger a BUG_ON().
8 #
9 #-----------------------------------------------------------------------
10 # Copyright (c) 2015 Fujitsu.  All Rights Reserved.
11 #
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.
15 #
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.
20 #
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 #-----------------------------------------------------------------------
25 #
26
27 seq=`basename $0`
28 seqres=$RESULT_DIR/$seq
29 echo "QA output created by $seq"
30
31 here=`pwd`
32 tmp=/tmp/$$
33 status=1        # failure is the default!
34
35 _cleanup()
36 {
37         rm -f $tmp.*
38 }
39
40 trap "_cleanup; exit \$status" 0 1 2 3 15
41
42 # get standard environment, filters and checks
43 . ./common/rc
44 . ./common/filter
45
46 # real QA test starts here
47 _supported_os Linux
48 _supported_fs generic
49 _require_test
50 _require_xfs_io_command "fcollapse"
51
52 testfile=$TEST_DIR/testfile.$seq
53 NCPUS=`$here/src/feature -o`
54 # cap NCPUS to 8 at maximum to avoid long run time on hosts with many cpus
55 if [ $NCPUS -gt 8 ]; then
56         NCPUS=8
57 fi
58 OUTER_LOOPS=$((10 * $NCPUS * $LOAD_FACTOR))
59 INNER_LOOPS=$((50 * $NCPUS * $LOAD_FACTOR))
60 # fcollapse/truncate continuously and simultaneously a same file
61 for ((i=1; i <= OUTER_LOOPS; i++)); do
62         for ((i=1; i <= INNER_LOOPS; i++)); do
63                 $XFS_IO_PROG -f -c 'truncate 100k' \
64                         -c 'fcollapse 0 16k' $testfile > /dev/null 2>&1
65         done &
66         for ((i=1; i <= INNER_LOOPS; i++)); do
67                 $XFS_IO_PROG -f -c 'truncate 0' $testfile > /dev/null 2>&1
68         done &
69 done
70 wait
71
72 echo "Silence is golden"
73 status=0
74 exit