2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat, Inc. All Rights Reserved.
7 # Test XFS log recovery ordering on v5 superblock filesystems. XFS had a problem
8 # where it would incorrectly replay older modifications from the log over more
9 # recent versions of metadata due to failure to update metadata LSNs during log
10 # recovery. This could result in false positive reports of corruption during log
11 # recovery and permanent mount failure.
13 # To test this situation, run frequent shutdowns immediately after log recovery.
14 # Ensure that log recovery does not recover stale modifications and cause
15 # spurious corruption reports and/or mount failures.
18 seqres=$RESULT_DIR/$seq
19 echo "QA output created by $seq"
23 status=1 # failure is the default!
24 trap "_cleanup; exit \$status" 0 1 2 3 15
30 $KILLALL_PROG -9 fsstress > /dev/null 2>&1
31 _scratch_unmount > /dev/null 2>&1
34 # get standard environment, filters and checks
37 # Modify as appropriate.
41 _require_local_device $SCRATCH_DEV
42 _require_scratch_shutdown
43 _require_command "$KILLALL_PROG" "killall"
47 echo "Silence is golden."
49 _scratch_mkfs >> $seqres.full 2>&1
50 _require_metadata_journaling $SCRATCH_DEV
53 for i in $(seq 1 $((50 * TIME_FACTOR)) ); do
54 ($FSSTRESS_PROG $FSSTRESS_AVOID -d $SCRATCH_MNT -n 999999 -p 4 >> $seqres.full &) \
57 # purposely include 0 second sleeps to test shutdown immediately after
62 ps -e | grep fsstress > /dev/null 2>&1
63 while [ $? -eq 0 ]; do
64 $KILLALL_PROG -9 fsstress > /dev/null 2>&1
66 ps -e | grep fsstress > /dev/null 2>&1
69 # Toggle between rw and ro mounts for recovery. Quit if any mount
70 # attempt fails so we don't shutdown the host fs.
71 if [ $((RANDOM % 2)) -eq 0 ]; then
72 _scratch_cycle_mount || _fail "cycle mount failed"
74 _scratch_cycle_mount "ro" || _fail "cycle ro mount failed"
75 _scratch_cycle_mount || _fail "cycle rw mount failed"