2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2018 CTERA Networks. All Rights Reserved.
7 # Test ro/rw fd data inconsistecies
9 # This is a variant of test overlay/016 with mread instead of pread.
11 # This simple test demonstrates a known issue with overlayfs:
12 # - process A opens file F for read + mmap
13 # - process B writes new data to file F
14 # - process A reads old data from mapped memory
17 seqres=$RESULT_DIR/$seq
18 echo "QA output created by $seq"
21 status=1 # failure is the default!
22 trap "_cleanup; exit \$status" 0 1 2 3 15
30 # get standard environment, filters and checks
34 # real QA test starts here
38 _require_xfs_io_command "open"
42 _scratch_mkfs >>$seqres.full 2>&1
44 # Create our test files.
45 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
47 echo "This is old news" > $lowerdir/foo
53 # mmap MAP_SHARED|PROT_READ of rofd
55 # read from mapped memory
57 $XFS_IO_PROG -r $SCRATCH_MNT/foo \
59 -C "open $SCRATCH_MNT/foo" \
60 -C "pwrite -S 0x61 0 16" \
62 | _filter_xfs_io | _filter_scratch