overlay: run unionmount testsuite test cases
[xfstests-dev.git] / tests / generic / 391
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Facebook.  All Rights Reserved.
4 #
5 # FS QA Test 391
6 #
7 # Test two threads doing non-overlapping direct I/O in the same extents.
8 # Motivated by a bug in Btrfs' direct I/O get_block function which would lead
9 # to spurious -EEXIST failures from direct I/O reads.
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
19
20 _cleanup()
21 {
22         cd /
23         rm -f $tmp.*
24         rm -f "$testfile"
25 }
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/filter
30
31 # remove previous $seqres.full before test
32 rm -f $seqres.full
33
34 # real QA test starts here
35
36 _supported_fs generic
37 _supported_os Linux
38 _require_test
39 _require_xfs_io_command "falloc"
40 _require_test_program "dio-interleaved"
41 _require_odirect
42
43 extent_size="$(($(_get_block_size "$TEST_DIR") * 2))"
44 num_extents=1024
45 testfile="$TEST_DIR/$$-testfile"
46
47 $XFS_IO_PROG -fc "truncate 0" "$testfile"
48 for ((off = 0; off < num_extents * extent_size; off += extent_size)); do
49         $XFS_IO_PROG -c "falloc $off $extent_size" "$testfile"
50 done
51
52 # To reproduce the Btrfs bug, the extent map must not be cached in memory.
53 sync
54 echo 3 > /proc/sys/vm/drop_caches
55
56 "$here/src/dio-interleaved" "$extent_size" "$num_extents" "$testfile"
57
58 echo "Silence is golden"
59
60 # success, all done
61 status=0
62 exit