generic: test for file loss after mix of rename, fsync and inode eviction
[xfstests-dev.git] / tests / generic / 511
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Oracle, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 511
6 #
7 # Test a specific sequence of fsx operations that causes an mmap read past
8 # eof to return nonzero contents.
9 #
10 . ./common/preamble
11 _begin_fstest auto quick rw zero
12
13 # Import common functions.
14 . ./common/punch
15
16 # real QA test starts here
17 _supported_fs generic
18 _require_scratch
19 _require_xfs_io_command "falloc" "-k"
20 _require_xfs_io_command "fzero"
21
22 _scratch_mkfs_sized $((1024 * 1024 * 256)) >>$seqres.full 2>&1
23 _scratch_mount
24
25 $XFS_IO_PROG -fc "pwrite 0 256m" -c fsync $SCRATCH_MNT/file >>$seqres.full 2>&1
26 rm -f $SCRATCH_MNT/file
27
28 cat >> $tmp.fsxops << ENDL
29 truncate 0x0 0x1f0d6 0x380e1
30 write 0x1ad87 0x6c99 0x180d6
31 zero_range 0x14426 0xd3aa 0x21a20 keep_size
32 mapread 0x1f69a 0x2386 0x21a20
33 ENDL
34
35 victim=$SCRATCH_MNT/a
36 touch $victim
37 $here/ltp/fsx --replay-ops $tmp.fsxops $victim > $tmp.output 2>&1 || cat $tmp.output
38
39 echo "Silence is golden"
40 status=0
41 exit