generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / generic / 031
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2014 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. generic/031
6 #
7 # Test non-aligned writes against fcollapse to ensure that partial pages are
8 # correctly written and aren't left behind causing invalidation or data
9 # corruption issues.
10 #
11 . ./common/preamble
12 _begin_fstest auto quick prealloc rw collapse
13
14 # Import common functions.
15 . ./common/filter
16
17 # real QA test starts here
18
19 # Modify as appropriate.
20 _supported_fs generic
21 _require_scratch
22 _require_xfs_io_command "fcollapse"
23
24 testfile=$SCRATCH_MNT/testfile
25
26 _scratch_mkfs > /dev/null 2>&1
27 _scratch_mount
28
29 $XFS_IO_PROG -f \
30         -c "pwrite 185332 55756" \
31         -c "fcollapse 28672 40960" \
32         -c "pwrite 133228 63394" \
33         -c "fcollapse 0 4096" \
34 $testfile | _filter_xfs_io
35
36 echo "==== Pre-Remount ==="
37 hexdump -C $testfile
38 _scratch_cycle_mount
39 echo "==== Post-Remount =="
40 hexdump -C $testfile
41
42 status=0
43 exit
44