generic: test for creating duplicate filenames in encrypted dir
[xfstests-dev.git] / tests / generic / 438
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 SUSE.  All Rights Reserved.
4 #
5 # FS QA Test 438
6 #
7 # This is a regression test for kernel patch
8 #   "ext4: Fix data corruption for mmap writes"
9 #
10 # The problem this test checks for is when too much is zeroed in the tail
11 # page that gets written out just while the file gets extended and written
12 # to through mmap.
13 #
14 # Based on test program by Michael Zimmer <michael@swarm64.com>
15 #
16 seq=`basename $0`
17 seqres=$RESULT_DIR/$seq
18 echo "QA output created by $seq"
19
20 here=`pwd`
21 tmp=/tmp/$$
22 status=1        # failure is the default!
23 trap "_cleanup; exit \$status" 0 1 2 3 15
24
25 _cleanup()
26 {
27         cd /
28         rm -f $tmp.*
29         rm -f $FILE
30 }
31
32 # get standard environment, filters and checks
33 . ./common/rc
34 . ./common/filter
35
36 # remove previous $seqres.full before test
37 rm -f $seqres.full
38
39 # Modify as appropriate.
40 _supported_fs generic
41 _require_test
42 _require_test_program "t_mmap_fallocate"
43
44 # real QA test starts here
45 FILE=$TEST_DIR/testfile_fallocate
46 # Make sure file exists
47 echo >$FILE
48 # Force frequent writeback of the file
49 (
50         trap "STOP=1" SIGTERM
51         STOP=0
52         while [ $STOP -eq 0 ]; do
53                 $XFS_IO_PROG -c fsync $FILE
54         done
55 )&
56 SYNCPID=$!
57
58 # Run the test
59 $here/src/t_mmap_fallocate $FILE 256 && echo "Silence is golden"
60
61 kill -TERM $SYNCPID
62 wait $SYNCPID
63
64 # success, all done
65 status=0
66 exit