generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / generic / 269
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FSQA Test No. 269
6 #
7 # Run fsstress and ENOSPC hitters in parallel, check fs consistency at the end
8 #
9 . ./common/preamble
10 _begin_fstest auto rw prealloc ioctl enospc stress
11
12 # Import common functions.
13 . ./common/filter
14 # Disable all sync operations to get higher load
15 FSSTRESS_AVOID="$FSSTRESS_AVOID -ffsync=0 -fsync=0 -ffdatasync=0"
16 _workout()
17 {
18         echo ""
19         echo "Run fsstress"
20         echo ""
21         num_iterations=10
22         enospc_time=2
23         out=$SCRATCH_MNT/fsstress.$$
24         args=`_scale_fsstress_args -p128 -n999999999 -f setattr=1 $FSSTRESS_AVOID -d $out`
25         echo "fsstress $args" >> $seqres.full
26         $FSSTRESS_PROG $args &>> $seqres.full &
27         pid=$!
28         echo "Run dd writers in parallel"
29         for ((i=0; i < num_iterations; i++))
30         do
31                 # File will be opened with O_TRUNC each time
32                 dd if=/dev/zero of=$SCRATCH_MNT/SPACE_CONSUMER bs=1M \
33                         >> $seqres.full 2>&1
34                 sleep $enospc_time
35         done
36         echo "Killing fsstress process..." >> $seqres.full
37         kill $pid >> $seqres.full 2>&1
38         wait $pid
39 }
40
41 # real QA test starts here
42 _supported_fs generic
43 _require_scratch
44
45 _scratch_mkfs_sized $((512 * 1024 * 1024)) >> $seqres.full 2>&1
46 _scratch_mount
47
48 if ! _workout; then
49         _scratch_unmount 2>/dev/null
50         exit
51 fi
52
53 if ! _scratch_unmount; then
54         echo "failed to umount"
55         status=1
56         exit
57 fi
58 status=0
59 exit