common/rc: add _scratch_{u}mount_idmapped() helpers
[xfstests-dev.git] / tests / xfs / 079
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2015 Red Hat, Inc. All Rights Reserved.
4 #
5 # FS QA Test No. 079
6 #
7 # Regression test for a bug in the log record checksum mechanism of XFS. Log
8 # records are checksummed during recovery and a warning or mount failure occurs
9 # on checksum verification failure. XFS had a bug where the checksum mechanism
10 # verified different parts of a record depending on the current log buffer size.
11 # This caused spurious checksum failures when a filesystem is recovered using a
12 # different log buffer size from when the filesystem crashed.
13 #
14 # Test that log recovery succeeds with a different log buffer size from when the
15 # filesystem crashed.
16 #
17 seq=`basename $0`
18 seqres=$RESULT_DIR/$seq
19 echo "QA output created by $seq"
20
21 here=`pwd`
22 tmp=/tmp/$$
23 status=1        # failure is the default!
24 trap "_cleanup; exit \$status" 0 1 2 3 15
25
26 _cleanup()
27 {
28         cd /
29         rm -f $tmp.*
30         $KILLALL_PROG -9 fsstress > /dev/null 2>&1
31         wait > /dev/null 2>&1
32 }
33
34 rm -f $seqres.full
35
36 # get standard environment, filters and checks
37 . ./common/rc
38 . ./common/log
39
40 # real QA test starts here
41
42 # Modify as appropriate.
43 _supported_fs xfs
44 _require_scratch
45 _require_v2log
46 _require_command "$KILLALL_PROG" killall
47
48 echo "Silence is golden."
49
50 dmesg -c > /dev/null
51
52 _scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
53 _scratch_mount "-o logbsize=32k"
54
55 # Run a workload to dirty the log, wait a bit and shutdown the fs.
56 $FSSTRESS_PROG -d $SCRATCH_MNT -p 4 -n 99999999 >> $seqres.full 2>&1 &
57 sleep 10
58 _scratch_shutdown -f
59 wait
60
61 # Remount with a different log buffer size. Going from 32k to 64k increases the
62 # log record extended header count, as the log record header can only handle 32k
63 # of space.
64 _scratch_unmount
65 _try_scratch_mount "-o logbsize=64k"
66
67 # The mount may not fail on v4 filesystems. Check for CRC mismatch warning
68 # messages to detect failure in this case.
69 dmesg -c | grep XFS | grep CRC
70
71 # success, all done
72 status=0
73 exit