blob: e00810d899cfef04bd180c0beb727f15d814994d (
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
|
# Simulate two disks failing shorty after each other
. tests/env-ddf-template
sda=$(get_rootdev) || exit 1
tmp=$(mktemp /tmp/mdtest-XXXXXX)
mdadm --zero-superblock $dev8 $dev9 $dev10 $dev11 $dev12 $dev13
mdadm -CR $container -e ddf -l container -n 6 \
$dev8 $dev9 $dev10 $dev11 $dev12 $dev13
#fast_sync
mdadm -CR $member0 -l raid6 -n 4 $dev10 $dev11 $dev12 $dev13 -z 16384
#$dir/mdadm -CR $member0 -l raid6 -n 4 $dev10 $dev11 $dev12 $dev13 -z 16384 \
# >/tmp/mdmon.txt 2>&1
mdadm -CR $member1 -l raid10 -n 4 $dev10 $dev11 $dev12 $dev13 -z 16384
dd if=$sda of=$member0 bs=1M count=32
dd if=$sda of=$member1 bs=1M skip=16 count=16
check wait
sum0=$(sha1sum $member0)
sum1=$(sha1sum $member1)
mdadm --fail $member1 $dev11
sleep 1
mdadm --fail $member1 $dev12
# We will have 4 resync procedures, 2 spares for 2 arrays.
mdadm --wait $member1 $member0 || true
mdadm --wait $member1 $member0 || true
devs0="$(get_raiddisks $member0)"
devs1="$(get_raiddisks $member1)"
expected="$dev10
$dev13
$dev8
$dev9"
ret=0
if [ "$(echo "$devs0" | sort)" != "$expected" \
-o "$(echo "$devs1" | sort)" != "$expected" ]; then
echo ERROR: unexpected members
echo $member0: $devs0
echo $member1: $devs1
ret=1
fi
mdadm -E $dev10 >$tmp
if ! grep -q 'state\[0\] : Optimal, Consistent' $tmp; then
echo ERROR: $member0 should be optimal in meta data
ret=1
fi
if ! grep -q 'state\[1\] : Optimal, Consistent' $tmp; then
echo ERROR: $member1 should be optimal in meta data
ret=1
fi
if [ x"$(grep -c active/Online $tmp)" != x4 ]; then
echo ERROR: expected 4 online disks
ret=1
fi
if [ x"$(grep -c "Offline, Failed" $tmp)" != x2 ]; then
echo ERROR: expected 2 failed disks
ret=1
fi
sum0a=$(sha1sum $member0)
sum1a=$(sha1sum $member1)
if [ "$sum0" != "$sum0a" -o "$sum1" != "$sum1a" ]; then
echo ERROR: checksum mismatch
ret=1
fi
if [ $ret -eq 1 ]; then
cat /proc/mdstat
cat $tmp
fi
[ -f /tmp/mdmon.txt ] && {
cat /tmp/mdmon.txt
rm -f /tmp/mdmon.txt
}
rm -f $tmp
[ $ret -eq 0 ]
|