generic: test MADV_POPULATE_READ with IO errors
[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 . ./common/preamble
18 _begin_fstest shutdown auto log quick
19
20 # Override the default cleanup function.
21 _cleanup()
22 {
23         cd /
24         rm -f $tmp.*
25         $KILLALL_PROG -9 fsstress > /dev/null 2>&1
26         wait > /dev/null 2>&1
27 }
28
29 # Import common functions.
30 . ./common/log
31
32 # real QA test starts here
33
34 # Modify as appropriate.
35 _supported_fs xfs
36 _require_scratch
37 _require_v2log
38 _require_command "$KILLALL_PROG" killall
39
40 echo "Silence is golden."
41
42 dmesg -c > /dev/null
43
44 _scratch_mkfs >> $seqres.full 2>&1 || _fail "mkfs failed"
45 _scratch_mount "-o logbsize=32k"
46
47 # Run a workload to dirty the log, wait a bit and shutdown the fs.
48 $FSSTRESS_PROG -d $SCRATCH_MNT -p 4 -n 99999999 >> $seqres.full 2>&1 &
49 sleep 10
50 _scratch_shutdown -f
51 wait
52
53 # Remount with a different log buffer size. Going from 32k to 64k increases the
54 # log record extended header count, as the log record header can only handle 32k
55 # of space.
56 _scratch_unmount
57 _try_scratch_mount "-o logbsize=64k"
58
59 # The mount may not fail on v4 filesystems. Check for CRC mismatch warning
60 # messages to detect failure in this case.
61 dmesg -c | grep XFS | grep CRC
62
63 # success, all done
64 status=0
65 exit