blob: 1c6709648d6a7631b60bb790e160b2c28616e366 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2013 Oracle, Inc. All Rights Reserved.
#
# FS QA Test No. 051
#
# Simulate a buffer use after free race in XFS log recovery. The race triggers
# on I/O failures during log recovery. Note that this test is dangerous as it
# causes BUG() errors or a panic.
#
. ./common/preamble
_begin_fstest shutdown auto log metadata
# Override the default cleanup function.
_cleanup()
{
cd /
rm -f $tmp.*
$KILLALL_PROG -9 $FSSTRESS_PROG > /dev/null 2>&1
_scratch_unmount > /dev/null 2>&1
}
# Import common functions.
. ./common/dmflakey
# Modify as appropriate.
_supported_fs xfs
_require_scratch
_require_dm_target flakey
_require_xfs_sysfs debug/log_recovery_delay
_require_command "$KILLALL_PROG" killall
echo "Silence is golden."
_scratch_mkfs_xfs >/dev/null 2>&1
_scratch_mount
# Start a workload and shutdown the fs. The subsequent mount will require log
# recovery.
$FSSTRESS_PROG -n 9999 -p 2 -w -d $SCRATCH_MNT >> $seqres.full &
sleep 5
_scratch_shutdown -f
$KILLALL_PROG -q $FSSTRESS_PROG
wait
_scratch_unmount
# Initialize a dm-flakey device that will pass I/Os for 5s and fail thereafter.
_init_flakey
BLK_DEV_SIZE=`blockdev --getsz $SCRATCH_DEV`
FLAKEY_TABLE="0 $BLK_DEV_SIZE flakey $SCRATCH_DEV 0 5 180"
_load_flakey_table $FLAKEY_ALLOW_WRITES
# Set a 10s log recovery delay and mount the flakey device. This should allow
# initial writes to proceed (e.g., stale log block reset) and then let the
# flakey uptime timer expire such that I/Os will fail by the time log recovery
# starts.
echo 10 > /sys/fs/xfs/debug/log_recovery_delay
# The mount should fail due to dm-flakey. Note that this is dangerous on kernels
# without the xfs_buf log recovery race fixes.
_mount_flakey > /dev/null 2>&1
echo 0 > /sys/fs/xfs/debug/log_recovery_delay
_cleanup_flakey
# replay the log
_scratch_mount
_scratch_unmount
# success, all done
status=0
exit
|