]>
Commit | Line | Data |
---|---|---|
5e7519fa NB |
1 | set -e |
2 | ||
3 | # | |
4 | # create a raid1 with 3 devices and a bitmap file | |
5 | # make sure resync does right thing. | |
6 | # | |
7 | # | |
8 | bmf=$targetdir/bitmap | |
9 | rm -f $bmf | |
dab6685f NB |
10 | mdadm --create --run $md0 --level=1 -n3 --delay=1 --bitmap $bmf $dev1 $dev2 $dev3 |
11 | check wait | |
12 | testdev $md0 1 $mdsize0 1 | |
13 | mdadm -S $md0 | |
14 | ||
15 | mdadm --assemble $md0 --bitmap=$bmf $dev1 $dev2 $dev3 | |
16 | testdev $md0 1 $mdsize0 1 | |
17 | dirty1=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` | |
5e7519fa | 18 | sleep 4 |
dab6685f | 19 | dirty2=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` |
5e7519fa NB |
20 | |
21 | if [ $dirty1 -lt 400 -o $dirty2 -ne 0 ] | |
22 | then echo >&2 "ERROR bad 'dirty' counts: $dirty1 and $dirty2" | |
23 | exit 1 | |
24 | fi | |
dab6685f NB |
25 | mdadm $md0 -f $dev2 |
26 | testdev $md0 1 $mdsize0 1 | |
5e7519fa | 27 | sleep 4 |
dab6685f | 28 | dirty3=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` |
5e7519fa NB |
29 | if [ $dirty3 -lt 400 ] |
30 | then | |
31 | echo >&2 "ERROR dirty count $dirty3 is too small" | |
32 | exit 2 | |
33 | fi | |
34 | ||
dab6685f | 35 | mdadm -S $md0 |
5e7519fa | 36 | |
dab6685f NB |
37 | mdadm --assemble -R $md0 --bitmap=$bmf $dev1 $dev3 |
38 | check nosync | |
39 | mdadm $md0 --add $dev2 | |
40 | check recovery | |
5e7519fa | 41 | |
dab6685f NB |
42 | dirty4=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` |
43 | check wait | |
5e7519fa | 44 | sleep 4 |
dab6685f | 45 | dirty5=`mdadm -X $bmf | sed -n -e 's/.*Bitmap.* \([0-9]*\) dirty.*/\1/p'` |
5e7519fa NB |
46 | |
47 | if [ $dirty4 -lt 400 -o $dirty5 -ne 0 ] | |
48 | then echo echo >&2 "ERROR bad 'dirty' counts at end: $dirty4 $dirty5" | |
49 | exit 1 | |
50 | fi | |
51 | ||
dab6685f | 52 | mdadm -S $md0 |
5e7519fa | 53 | exit 0 |