2 # SPDX-License-Identifier: GPL-2.0-or-later
3 # Copyright (c) 2020 Oracle, Inc. All Rights Reserved.
7 # Race freeze and fsmap for a while to see if we crash or livelock.
10 _begin_fstest auto quick fsmap freeze
12 _register_cleanup "_cleanup" BUS
14 # Override the default cleanup function.
18 $XFS_IO_PROG -x -c 'thaw' $SCRATCH_MNT > /dev/null 2>&1
22 # Import common functions.
27 # real QA test starts here
29 _require_xfs_scratch_rmapbt
30 _require_xfs_io_command "fsmap"
31 _require_command "$KILLALL_PROG" killall
34 echo "Format and populate"
35 _scratch_mkfs > "$seqres.full" 2>&1
38 STRESS_DIR="$SCRATCH_MNT/testdir"
41 for i in $(seq 0 9); do
42 mkdir -p $STRESS_DIR/$i
43 for j in $(seq 0 9); do
44 mkdir -p $STRESS_DIR/$i/$j
45 for k in $(seq 0 9); do
46 echo x > $STRESS_DIR/$i/$j/$k
51 cpus=$(( $(src/feature -o) * 4 * LOAD_FACTOR))
53 echo "Concurrent fsmap and freeze"
55 egrep -v '(Device or resource busy|Invalid argument)'
60 while [ "$(date +%s)" -lt $end ]; do
61 $XFS_IO_PROG -x -c 'freeze' $SCRATCH_MNT 2>&1 | filter_output
62 $XFS_IO_PROG -x -c 'thaw' $SCRATCH_MNT 2>&1 | filter_output
68 while [ "$(date +%s)" -lt $end ]; do
69 $XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT > /dev/null
75 FSSTRESS_ARGS=$(_scale_fsstress_args -p 4 -d $SCRATCH_MNT -n 2000 $FSSTRESS_AVOID)
76 while [ "$(date +%s)" -lt $end ]; do
77 $FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full
82 end=$((start + (30 * TIME_FACTOR) ))
84 echo "Loop started at $(date --date="@${start}"), ending at $(date --date="@${end}")" >> $seqres.full
89 # Wait until 2 seconds after the loops should have finished...
90 while [ "$(date +%s)" -lt $((end + 2)) ]; do
94 # ...and clean up after the loops in case they didn't do it themselves.
95 $KILLALL_PROG -TERM xfs_io fsstress >> $seqres.full 2>&1
96 $XFS_IO_PROG -x -c 'thaw' $SCRATCH_MNT >> $seqres.full 2>&1
98 echo "Loop finished at $(date)" >> $seqres.full