common/fuzzy: try to clear blocking flags first in _scratch_fuzz_modify
[xfstests-dev.git] / tests / generic / 470
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Intel Corporation.  All Rights Reserved.
4 #
5 # FS QA Test No. 470
6 #
7 # Use dm-log-writes to verify that MAP_SYNC actually syncs metadata during
8 # page faults.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 tmp=/tmp/$$
15 here=`pwd`
16 status=1        # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21         cd /
22         _log_writes_cleanup
23         rm -f $tmp.*
24 }
25
26 # get standard environment, filters and checks
27 . ./common/rc
28 . ./common/filter
29 . ./common/dmlogwrites
30
31 # remove previous $seqres.full before test
32 rm -f $seqres.full
33
34 # real QA test starts here
35 _supported_fs generic
36 _supported_os Linux
37 _require_scratch
38 _require_log_writes_dax
39 _require_xfs_io_command "mmap" "-S"
40 _require_xfs_io_command "log_writes"
41
42 _log_writes_init $SCRATCH_DEV
43 _log_writes_mkfs >> $seqres.full 2>&1
44 _log_writes_mount -o dax
45
46 LEN=$((1024 * 1024)) # 1 MiB
47
48 $XFS_IO_PROG -t -c "truncate $LEN" -c "mmap -S 0 $LEN" -c "mwrite 0 $LEN" \
49         -c "log_writes -d $LOGWRITES_NAME -m preunmap" \
50         -f $SCRATCH_MNT/test
51
52 # Unmount the scratch dir and tear down the log writes target
53 _log_writes_unmount
54 _log_writes_remove
55 _check_scratch_fs
56
57 # destroy previous filesystem so we can be sure our rebuild works
58 _scratch_mkfs >> $seqres.full 2>&1
59
60 # check pre-unmap state
61 _log_writes_replay_log preunmap $SCRATCH_DEV
62 _scratch_mount
63
64 # We should see $SCRATCH_MNT/test as having 1 MiB in block allocations
65 du -sh $SCRATCH_MNT/test | _filter_scratch | _filter_spaces
66
67 status=0
68 exit