blob: 416b929a9e65cb92093562b74ca33b4ef993fcd6 (
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2018 SUSE Linux Products GmbH. All Rights Reserved.
#
# FS QA Test 482
#
# Test filesystem consistency after each FUA operation
#
# Will do log replay and check the filesystem.
#
. ./common/preamble
_begin_fstest auto metadata replay thin
# Override the default cleanup function.
#
# If debugging logwrites failures using the tools/dm-logwrite-replay script,
# switch the cleanup function to the version that is commented out below so that
# failure leaves the corpse intact for post-mortem failure analysis.
_cleanup()
{
cd /
$KILLALL_PROG -KILL -q $FSSTRESS_PROG &> /dev/null
_log_writes_cleanup &> /dev/null
_dmthin_cleanup
rm -f $tmp.*
}
# tools/dm-logwrite-replay _cleanup version
#_cleanup()
#{
# cd /
# $KILLALL_PROG -KILL -q $FSSTRESS_PROG &> /dev/null
# if [ $status -eq 0 ]; then
# _log_writes_cleanup &> /dev/null
# _dmthin_cleanup
# else
# echo dm-thinvol-dev: $DMTHIN_VOL_DEV >> $seqres.full
# fi
# rm -f $tmp.*
#}
# Import common functions.
. ./common/filter
. ./common/dmthin
. ./common/dmlogwrites
# real QA test starts here
# Modify as appropriate.
_supported_fs generic
_require_command "$KILLALL_PROG" killall
# Use thin device as replay device, which requires $SCRATCH_DEV
_require_scratch_nocheck
# and we need extra device as log device
_require_log_writes
_require_dm_target thin-pool
nr_cpus=$("$here/src/feature" -o)
# cap nr_cpus to 8 to avoid spending too much time on hosts with many cpus
if [ $nr_cpus -gt 8 ]; then
nr_cpus=8
fi
fsstress_args=$(_scale_fsstress_args -w -d $SCRATCH_MNT -n 512 -p $nr_cpus \
$FSSTRESS_AVOID)
devsize=$((1024*1024*200 / 512)) # 200m phys/virt size
csize=$((1024*64 / 512)) # 64k cluster size
lowspace=$((1024*1024 / 512)) # 1m low space threshold
# Use a thin device to provide deterministic discard behavior. Discards are used
# by the log replay tool for fast zeroing to prevent out-of-order replay issues.
_test_unmount
_dmthin_init $devsize $devsize $csize $lowspace
_log_writes_init $DMTHIN_VOL_DEV
_log_writes_mkfs >> $seqres.full 2>&1
_log_writes_mark mkfs
_log_writes_mount
run_check $FSSTRESS_PROG $fsstress_args > /dev/null 2>&1
_log_writes_unmount
_log_writes_remove
prev=$(_log_writes_mark_to_entry_number mkfs)
[ -z "$prev" ] && _fail "failed to locate entry mark 'mkfs'"
cur=$(_log_writes_find_next_fua $prev)
[ -z "$cur" ] && _fail "failed to locate next FUA write"
while [ ! -z "$cur" ]; do
_log_writes_replay_log_range $cur $DMTHIN_VOL_DEV >> $seqres.full
# Here we need extra mount to replay the log, mainly for journal based
# fs, as their fsck will report dirty log as error.
# We don't care to preserve any data on the replay dev, as we can replay
# back to the point we need, and in fact sometimes creating/deleting
# snapshots repeatedly can be slower than replaying the log.
_dmthin_mount
_dmthin_check_fs
prev=$cur
cur=$(_log_writes_find_next_fua $(($cur + 1)))
[ -z "$cur" ] && break
done
echo "Silence is golden"
# success, all done
status=0
exit
|