2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2004 Silicon Graphics, Inc. All Rights Reserved.
7 # To test log replay with version 2 logs
8 # Initially keep this simple with just creates.
9 # In another qa test we can do more e.g. use fsstress.
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
17 status=1 # failure is the default!
18 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
20 # get standard environment, filters and checks
25 # real QA test starts here
29 rm -f $seqres.full $tmp.*
31 _require_scratch_shutdown
35 _scratch_unmount >/dev/null 2>&1
37 _scratch_mkfs >/dev/null 2>&1
38 _require_metadata_journaling $SCRATCH_DEV
40 _get_log_configs > $tmp.seq.params
42 # Do the work for various log params which
43 # should not effect the data content of the log
44 # Try with and without sync'ing - sync'ing will mean that
45 # the log will be written out unfilled and thus the log
46 # stripe can have an effect.
48 for s in sync nosync ; do
50 | while read mkfs mnt restofline
52 if [ "$mkfs" = "#" ]; then
56 echo "--- mkfs=$mkfs, mnt=$mnt, sync=$s ---" >>$seqres.full
57 export MKFS_OPTIONS="-l $mkfs"
58 export MOUNT_OPTIONS="-o $mnt"
62 _scratch_mkfs >>$seqres.full 2>&1
63 if [ $? -ne 0 ] ; then
64 _echofull "mkfs failed: $MKFS_OPTIONS"
70 if ! _try_scratch_mount >>$seqres.full 2>&1; then
71 _echofull "mount failed: $MOUNT_OPTIONS"
76 if [ $s = "sync" ]; then
77 # generate some log traffic - but not too much
78 # add some syncs to get the log flushed to disk
79 for file in $SCRATCH_MNT/{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}; do
84 # generate some log traffic - but not too much - life gets a little
85 # more complicated if the log wraps around. This traffic is
86 # pretty much arbitary, but could probably be made better than this.
87 touch $SCRATCH_MNT/{0,1,2,3,4,5,6,7,8,9}{0,1,2,3,4,5,6,7,8,9}
90 # check before on what FS should look like
91 _echofull "ls SCRATCH_MNT"
92 ls $SCRATCH_MNT | _filter_lostfound
95 _scratch_shutdown -v -f >> $seqres.full
98 _scratch_unmount >>$seqres.full 2>&1 \
99 || _fail "umount failed"
101 _echofull "logprint after going down..."
104 _echofull "mount with replay"
105 _try_scratch_mount >>$seqres.full 2>&1 \
106 || _fail "mount failed: $MOUNT_OPTIONS"
108 # check on what FS looks like after log recovery
109 _echofull "ls SCRATCH_MNT"
110 ls $SCRATCH_MNT | _filter_lostfound
115 _echofull "logprint after mount and replay..."
118 if _check_scratch_fs; then
119 _echofull "filesystem is checked ok"
121 _echofull "filesystem is NOT ok"