generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / overlay / 016
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2016 CTERA Networks. All Rights Reserved.
4 #
5 # FSQA Test No. 016
6 #
7 # Test ro/rw fd data inconsistecies
8 #
9 # This simple test demonstrates an issue with overlayfs on kernel < v4.19:
10 # - process A opens file F for read
11 # - process B writes new data to file F
12 # - process A reads old data from file F
13 #
14 . ./common/preamble
15 _begin_fstest auto quick copyup
16
17 # Import common functions.
18 . ./common/filter
19
20 # real QA test starts here
21 _supported_fs overlay
22 _fixed_in_kernel_version "v4.19"
23
24 _require_scratch
25 _require_xfs_io_command "open"
26
27 _scratch_mkfs >>$seqres.full 2>&1
28
29 # Create our test files.
30 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
31 mkdir -p $lowerdir
32 echo "This is old news" > $lowerdir/foo
33
34 _scratch_mount
35
36 #
37 # open file for read (rofd)
38 # open file for write (rwfd)
39 # write to rwfd
40 # read from rofd
41 #
42 $XFS_IO_PROG -r $SCRATCH_MNT/foo \
43         -C "open $SCRATCH_MNT/foo" \
44         -C "pwrite -S 0x61 0 16" \
45         -C "file 0" \
46         -C "pread -v 0 16" \
47 | _filter_xfs_io | _filter_scratch
48
49 status=0
50 exit