generic: test deadlock on O_DIRECT|O_DSYNC
[xfstests-dev.git] / tests / generic / 511
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 511
6 #
7 # Test a specific sequence of fsx operations that causes an mmap read past
8 # eof to return nonzero contents.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13 tmp=/tmp/$$
14 status=1        # failure is the default!
15 trap "_cleanup; exit \$status" 0 1 2 3 15
16
17 _cleanup()
18 {
19         cd /
20         rm -f $tmp.*
21 }
22
23 # get standard environment, filters and checks
24 . ./common/rc
25 . ./common/punch
26
27 # real QA test starts here
28 _supported_fs generic
29 _supported_os Linux
30 _require_scratch
31 _require_xfs_io_command "falloc" "-k"
32 _require_xfs_io_command "fzero"
33
34 rm -f $seqres.full
35
36 _scratch_mkfs_sized $((1024 * 1024 * 256)) >>$seqres.full 2>&1
37 _scratch_mount
38
39 $XFS_IO_PROG -fc "pwrite 0 256m" -c fsync $SCRATCH_MNT/file >>$seqres.full 2>&1
40 rm -f $SCRATCH_MNT/file
41
42 cat >> $tmp.fsxops << ENDL
43 truncate 0x0 0x1f0d6 0x380e1
44 write 0x1ad87 0x6c99 0x180d6
45 zero_range 0x14426 0xd3aa 0x21a20 keep_size
46 mapread 0x1f69a 0x2386 0x21a20
47 ENDL
48
49 victim=$SCRATCH_MNT/a
50 touch $victim
51 $here/ltp/fsx --replay-ops $tmp.fsxops $victim > $tmp.output 2>&1 || cat $tmp.output
52
53 echo "Silence is golden"
54 status=0
55 exit