2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2016 CTERA Networks. All Rights Reserved.
7 # Test ro/rw fd data inconsistecies
9 # This simple test demonstrates a known issue with overlayfs:
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
15 seqres=$RESULT_DIR/$seq
16 echo "QA output created by $seq"
19 status=1 # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
28 # get standard environment, filters and checks
32 # real QA test starts here
36 _require_xfs_io_command "open"
40 _scratch_mkfs >>$seqres.full 2>&1
42 # Create our test files.
43 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
45 echo "This is old news" > $lowerdir/foo
46 echo "This is old news" > $lowerdir/bar
53 # open file for read (rofd)
54 # open file for write (rwfd)
58 $XFS_IO_PROG -r $SCRATCH_MNT/foo \
59 -C "open $SCRATCH_MNT/foo" \
60 -C "pwrite -S 0x61 0 16" \
63 | _filter_xfs_io | _filter_scratch
67 # mmap MAP_SHARED|PROT_READ of rofd
69 # read from mapped memory
71 $XFS_IO_PROG -r $SCRATCH_MNT/bar \
73 -C "open $SCRATCH_MNT/bar" \
74 -C "pwrite -S 0x61 0 16" \
76 | _filter_xfs_io | _filter_scratch