1 # This test creates a RAID1, fails a disk, and immediately
2 # (simultaneously) creates a new array. This tests for a possible
3 # race where the meta data reflecting the disk failure may not
4 # be written when the 2nd array is created.
5 . tests/env-ddf-template
7 mdadm --zero-superblock $dev8 $dev9 $dev10 $dev11 $dev12 $dev13
9 mdadm -CR $container -e ddf -l container -n 2 $dev11 $dev12
10 #$dir/mdadm -CR $member0 -l raid1 -n 2 $container -z 10000 >/tmp/mdmon.txt 2>&1
11 mdadm -CR $member0 -l raid1 -n 2 $container -z 10000
14 mdadm --fail $member0 $fail0 &
16 # The test can succeed two ways:
17 # 1) mdadm -C member1 fails - in this case the meta data
18 # was already on disk when the create attempt was made
19 # 2) mdadm -C succeeds in the first place (meta data not on disk yet),
20 # but mdmon detects the problem and sets the disk faulty.
22 if mdadm -CR $member1 -l raid1 -n 2 $container; then
24 echo create should have failed / race condition?
27 set -- $(get_raiddisks $member0)
30 if [ $1 = $fail0 -o $2 = $fail0 ]; then
33 set -- $(get_raiddisks $member1)
34 if [ $1 = $fail0 -o $2 = $fail0 ]; then
38 if [ $ret -eq 1 ]; then
39 echo ERROR: failed disk $fail0 is still a RAID member
40 echo $member0: $(get_raiddisks $member0)
41 echo $member1: $(get_raiddisks $member1)
43 tmp=$(mktemp /tmp/mdest-XXXXXX)
45 if [ x$(grep -c 'state\[[01]\] : Degraded' $tmp) != x2 ]; then
46 echo ERROR: non-degraded array found
50 if ! grep -q '^ *0 *[0-9a-f]\{8\} .*Offline, Failed' $tmp; then
51 echo ERROR: disk 0 not marked as failed in meta data
60 [ -f /tmp/mdmon.txt ] && {