generic/520: Remove sync in clean_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 _supported_os Linux
42 _require_test
43 _require_test_program "t_mmap_fallocate"
44
45 # real QA test starts here
46 FILE=$TEST_DIR/testfile_fallocate
47 # Make sure file exists
48 echo >$FILE
49 # Force frequent writeback of the file
50 (
51         trap "STOP=1" SIGTERM
52         STOP=0
53         while [ $STOP -eq 0 ]; do
54                 $XFS_IO_PROG -c fsync $FILE
55         done
56 )&
57 SYNCPID=$!
58
59 # Run the test
60 $here/src/t_mmap_fallocate $FILE 256 && echo "Silence is golden"
61
62 kill -TERM $SYNCPID
63 wait $SYNCPID
64
65 # success, all done
66 status=0
67 exit