xfs: Check for extent overflow when trivally adding a new extent
[xfstests-dev.git] / tests / xfs / 286
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Oracle, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 286
6 #
7 # Race fio and xfs_scrub for a while to see if we crash or livelock.
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 7 15
17
18 _cleanup()
19 {
20         cd /
21         rm -rf $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27 . ./common/fuzzy
28 . ./common/inject
29
30 # real QA test starts here
31 _supported_fs xfs
32 _require_test_program "feature"
33 _require_command "$KILLALL_PROG" killall
34 _require_command "$TIMEOUT_PROG" timeout
35 _require_scrub
36 _require_scratch
37 # xfs_scrub will turn on error injection itself
38 _require_xfs_io_error_injection "force_repair"
39
40 echo "Format and populate"
41 _scratch_mkfs > "$seqres.full" 2>&1
42 _scratch_mount
43
44 STRESS_DIR="$SCRATCH_MNT/testdir"
45 mkdir -p $STRESS_DIR
46
47 cpus=$(( $($here/src/feature -o) * 4 * LOAD_FACTOR))
48 $FSSTRESS_PROG -d $STRESS_DIR -p $cpus -n $((cpus * 100000)) $FSSTRESS_AVOID >/dev/null 2>&1 &
49 $XFS_SCRUB_PROG -d -T -v -n $SCRATCH_MNT >> $seqres.full
50
51 killstress() {
52         sleep $(( 60 * TIME_FACTOR ))
53         $KILLALL_PROG -q $FSSTRESS_PROG
54 }
55
56 echo "Concurrent repair"
57 start=$(date +%s)
58 end=$((start + (60 * TIME_FACTOR) ))
59 killstress &
60 echo "Repair started at $(date --date="@${start}"), ending at $(date --date="@${end}")" >> $seqres.full
61 while [ "$(date +%s)" -lt "$end" ]; do
62         XFS_SCRUB_FORCE_REPAIR=1 $TIMEOUT_PROG -s TERM $(( end - $(date +%s) + 2 )) $XFS_SCRUB_PROG -d -T -v $SCRATCH_MNT >> $seqres.full
63 done
64
65 echo "Test done"
66 echo "Repair finished at $(date)" >> $seqres.full
67 $KILLALL_PROG -q $FSSTRESS_PROG
68
69 # success, all done
70 status=0
71 exit