2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Oracle, Inc. All Rights Reserved.
7 # Race freeze and rmapbt repair for a while to see if we crash or livelock.
8 # rmapbt repair requires us to freeze the filesystem to stop all filesystem
9 # activity, so we can't have userspace wandering in and thawing it.
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
17 status=1 # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 7 15
26 # get standard environment, filters and checks
33 # real QA test starts here
35 _require_xfs_scratch_rmapbt
36 _require_xfs_io_command "scrub"
37 _require_xfs_io_error_injection "force_repair"
38 _require_command "$KILLALL_PROG" killall
40 echo "Format and populate"
41 _scratch_mkfs > "$seqres.full" 2>&1
44 STRESS_DIR="$SCRATCH_MNT/testdir"
47 for i in $(seq 0 9); do
48 mkdir -p $STRESS_DIR/$i
49 for j in $(seq 0 9); do
50 mkdir -p $STRESS_DIR/$i/$j
51 for k in $(seq 0 9); do
52 echo x > $STRESS_DIR/$i/$j/$k
57 cpus=$(( $($here/src/feature -o) * 4 * LOAD_FACTOR))
59 echo "Concurrent repair"
61 egrep -v '(Device or resource busy|Invalid argument)'
66 while [ "$(date +%s)" -lt $end ]; do
67 $XFS_IO_PROG -x -c 'freeze' -c 'thaw' $SCRATCH_MNT 2>&1 | filter_output
73 while [ "$(date +%s)" -lt $end ]; do
74 $XFS_IO_PROG -x -c 'repair rmapbt 0' -c 'repair rmapbt 1' $SCRATCH_MNT 2>&1 | filter_output
80 FSSTRESS_ARGS=$(_scale_fsstress_args -p 4 -d $SCRATCH_MNT -n 2000 $FSSTRESS_AVOID)
81 while [ "$(date +%s)" -lt $end ]; do
82 $FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full
85 $XFS_IO_PROG -x -c 'inject force_repair' $SCRATCH_MNT
88 end=$((start + (30 * TIME_FACTOR) ))
90 echo "Loop started at $(date --date="@${start}"), ending at $(date --date="@${end}")" >> $seqres.full
95 # Wait until 2 seconds after the loops should have finished...
96 while [ "$(date +%s)" -lt $((end + 2)) ]; do
100 # ...and clean up after the loops in case they didn't do it themselves.
101 $KILLALL_PROG -TERM xfs_io fsstress >> $seqres.full 2>&1
102 $XFS_IO_PROG -x -c 'thaw' $SCRATCH_MNT >> $seqres.full 2>&1
104 echo "Loop finished at $(date)" >> $seqres.full