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 # First kill and wait the freeze loop so it won't try to freeze fs again
15 # Then make sure fs is not frozen
16 # Then kill and wait for the rest of the workers
17 # Because if fs is frozen a killed writer will never exit
21 [ -n "$freeze_pid" ] && kill $sig $freeze_pid
24 $XFS_IO_PROG -x -c 'thaw' $SCRATCH_MNT
25 [ -n "$stress_pid" ] && kill $sig $stress_pid
26 [ -n "$fsmap_pid" ] && kill $sig $fsmap_pid
32 # Override the default cleanup function.
35 kill_loops -9 > /dev/null 2>&1
40 # Import common functions.
45 # real QA test starts here
47 _require_xfs_scratch_rmapbt
48 _require_xfs_io_command "fsmap"
49 _require_command "$KILLALL_PROG" killall
52 echo "Format and populate"
53 _scratch_mkfs > "$seqres.full" 2>&1
56 STRESS_DIR="$SCRATCH_MNT/testdir"
59 for i in $(seq 0 9); do
60 mkdir -p $STRESS_DIR/$i
61 for j in $(seq 0 9); do
62 mkdir -p $STRESS_DIR/$i/$j
63 for k in $(seq 0 9); do
64 echo x > $STRESS_DIR/$i/$j/$k
69 cpus=$(( $(src/feature -o) * 4 * LOAD_FACTOR))
71 echo "Concurrent fsmap and freeze"
73 egrep -v '(Device or resource busy|Invalid argument)'
78 while [ "$(date +%s)" -lt $end ]; do
79 $XFS_IO_PROG -x -c 'freeze' $SCRATCH_MNT 2>&1 | filter_output
80 $XFS_IO_PROG -x -c 'thaw' $SCRATCH_MNT 2>&1 | filter_output
86 while [ "$(date +%s)" -lt $end ]; do
87 $XFS_IO_PROG -c 'fsmap -v' $SCRATCH_MNT > /dev/null
93 FSSTRESS_ARGS=$(_scale_fsstress_args -p 4 -d $SCRATCH_MNT -n 2000 $FSSTRESS_AVOID)
94 while [ "$(date +%s)" -lt $end ]; do
95 $FSSTRESS_PROG $FSSTRESS_ARGS >> $seqres.full
100 end=$((start + (30 * TIME_FACTOR) ))
102 echo "Loop started at $(date --date="@${start}"), ending at $(date --date="@${end}")" >> $seqres.full
110 # Wait until 2 seconds after the loops should have finished...
111 while [ "$(date +%s)" -lt $((end + 2)) ]; do
115 # ...and clean up after the loops in case they didn't do it themselves.
116 kill_loops >> $seqres.full 2>&1
118 echo "Loop finished at $(date)" >> $seqres.full