generic: mmap and copy file data with page overlapping
[xfstests-dev.git] / tests / generic / 638
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2021 Red Hat Inc.  All Rights Reserved.
4 #
5 # FS QA Test 638
6 #
7 # This case mmaps several pages of a file, alloc pages, copy data with pages
8 # overlapping, e.g:
9 #       +-----------------------+
10 #       |        (copy)         |
11 #       |                       V
12 #    +---------------+---------------+------------
13 #    |AAAA| ........ |AAAA| ... |AAAA|AAAA|
14 #    +---------------+---------------+------------
15 #                       |            ^
16 #                       |   (copy)   |
17 #                       +------------+
18 #
19 # This's a regression test cover kernel commit:
20 #   4f06dd92b5d0 ("fuse: fix write deadlock")
21 #
22 seq=`basename $0`
23 seqres=$RESULT_DIR/$seq
24 echo "QA output created by $seq"
25
26 here=`pwd`
27 tmp=/tmp/$$
28 status=1        # failure is the default!
29 trap "_cleanup; exit \$status" 0 1 2 3 15
30
31 _cleanup()
32 {
33         cd /
34         rm -f $tmp.*
35 }
36
37 # get standard environment, filters and checks
38 . ./common/rc
39 . ./common/filter
40
41 # remove previous $seqres.full before test
42 rm -f $seqres.full
43
44 # real QA test starts here
45 _supported_fs generic
46 _require_test
47 _require_test_program "t_mmap_writev_overlap"
48
49 pagesize=`getconf PAGE_SIZE`
50 testfile=$TEST_DIR/mmap-writev-overlap
51 $XFS_IO_PROG -f -c "truncate 0" $testfile
52 $here/src/t_mmap_writev_overlap -b $pagesize -c 2 -l 64 $testfile
53
54 echo "Silence is golden"
55 # success, all done
56 status=0
57 exit