2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2018 CTERA Networks. All Rights Reserved.
7 # Test memory mapped data inconsistencies
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 created shared ro mmap on file F
13 # - process B created shared rw mmap on file F
14 # - process B writes new data to shared mmap
15 # - process A reads old data from shared mmap
18 seqres=$RESULT_DIR/$seq
19 echo "QA output created by $seq"
22 status=1 # failure is the default!
23 trap "_cleanup; exit \$status" 0 1 2 3 15
31 # get standard environment, filters and checks
35 # 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
54 # filter out these lines:
55 # [000] 0x7f3d9aece000 - 0x7f3d9aece010 r-- SCRATCH_MNT/foo (0 : 16)
60 # mmap MAP_SHARED|PROT_READ of rofd
61 # mmap MAP_SHARED|PROT_WRITE of rwfd
65 $XFS_IO_PROG -r $SCRATCH_MNT/foo \
68 -C "open $SCRATCH_MNT/foo" \
71 -C "mwrite -S 0x61 0 16" \
74 | _filter_xfs_io | _filter_scratch | filter_xfs_io_mmap
78 # Verify mmap write after close has persisted through mount cycle
79 echo "After mount cycle:"
80 $XFS_IO_PROG -r $SCRATCH_MNT/foo \
83 | _filter_xfs_io | _filter_scratch