generic: test for file loss after mix of rename, fsync and inode eviction
[xfstests-dev.git] / tests / generic / 095
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Red Hat Inc. All Rights Reserved.
4 #
5 # FS QA Test generic/095
6 #
7 # Concurrent mixed I/O (buffer I/O, aiodio, mmap, splice) on the same files
8 #
9 . ./common/preamble
10 _begin_fstest auto rw stress
11
12 # Import common functions.
13 . ./common/filter
14
15 # real QA test starts here
16 _supported_fs generic
17 _require_scratch
18 _require_odirect
19 _require_aio
20
21 iodepth=$((16 * LOAD_FACTOR))
22 iodepth_batch=$((8 * LOAD_FACTOR))
23 numjobs=$((5 * LOAD_FACTOR))
24 fio_config=$tmp.fio
25 fio_out=$tmp.fio.out
26 cat >$fio_config <<EOF
27 [global]
28 bs=8k
29 iodepth=$iodepth
30 iodepth_batch=$iodepth_batch
31 randrepeat=1
32 size=1m
33 directory=$SCRATCH_MNT
34 numjobs=$numjobs
35 [job1]
36 ioengine=sync
37 bs=1k
38 direct=1
39 rw=randread
40 filename=file1:file2
41 [job2]
42 ioengine=libaio
43 rw=randwrite
44 direct=1
45 filename=file1:file2
46 [job3]
47 bs=1k
48 ioengine=posixaio
49 rw=randwrite
50 direct=1
51 filename=file1:file2
52 [job4]
53 ioengine=splice
54 direct=1
55 rw=randwrite
56 filename=file1:file2
57 [job5]
58 bs=1k
59 ioengine=sync
60 rw=randread
61 filename=file1:file2
62 [job6]
63 ioengine=posixaio
64 rw=randwrite
65 filename=file1:file2
66 [job7]
67 ioengine=splice
68 rw=randwrite
69 filename=file1:file2
70 [job8]
71 ioengine=mmap
72 rw=randwrite
73 bs=1k
74 filename=file1:file2
75 [job9]
76 ioengine=mmap
77 rw=randwrite
78 direct=1
79 filename=file1:file2
80 EOF
81 # with ioengine=mmap and direct=1, fio requires bs to be at least pagesize,
82 # which is a fio built-in var.
83 echo 'bs=$pagesize' >> $fio_config
84
85 _require_fio $fio_config
86 _scratch_mkfs >>$seqres.full 2>&1
87 _scratch_mount
88
89 # There's a known EIO failure to report collisions between directio and buffered
90 # writes to userspace, refer to upstream linux 5a9d929d6e13. So ignore EIO error
91 # at here.
92 $FIO_PROG $fio_config --ignore_error=,EIO --output=$fio_out
93 cat $fio_out >> $seqres.full
94 echo "Silence is golden"
95
96 # xfs generates WARNINGs on purpose when applications mix buffered/mmap IO with
97 # direct IO on the same file. On the other hand, this fio job has been proven
98 # to be potent, we don't want to simply _disable_dmesg_check which could miss
99 # other potential bugs. So filter out the intentional WARNINGs, make sure test
100 # doesn't fail because of this warning and fails on other WARNINGs.
101
102 # umount before checking dmesg in case umount triggers any WARNING or Oops
103 _scratch_unmount
104
105 _check_dmesg _filter_aiodio_dmesg
106
107 status=$?
108 exit