Codebase list mdadm / 356e69d
mdadm: add test script for raid456 journal Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Shaohua Li <shli@fb.com> Signed-off-by: NeilBrown <neilb@suse.com> Song Liu authored 8 years ago NeilBrown committed 8 years ago
2 changed file(s) with 73 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
245245 fi
246246 ;;
247247
248 readonly )
249 grep -s "read-only" > /dev/null /proc/mdstat || {
250 echo >&2 "ERROR array is not read-only!"; cat /proc/mdstat ; exit 1; }
251 ;;
252
253 inactive )
254 grep -s "inactive" > /dev/null /proc/mdstat || {
255 echo >&2 "ERROR array is not inactive!"; cat /proc/mdstat ; exit 1; }
256 ;;
248257 * ) echo >&2 ERROR unknown check $1 ; exit 1;
249258 esac
250259 }
0 # check write journal of raid456
1
2 # test --detail
3 test_detail_shows_journal() {
4 mdadm -D $1 | grep journal || {
5 echo >&2 "ERROR --detail does show journal device!"; mdadm -D $1 ; exit 1; }
6 }
7
8 # test --examine
9 test_examine_shows_journal() {
10 mdadm -E $1 | grep Journal || {
11 echo >&2 "ERROR --examine does show Journal device!"; mdadm -E $1 ; exit 1; }
12 }
13
14 # test --create
15 create_with_journal_and_stop() {
16 mdadm -CR $md0 -l5 -n4 $dev0 $dev1 $dev2 $dev3 --write-journal $dev4
17 check wait
18 tar cf - /etc > $md0
19 ./raid6check $md0 0 0 | grep 'Error detected' && exit 1
20 test_detail_shows_journal $md0
21 test_examine_shows_journal $dev4
22 mdadm -S $md0
23 }
24
25 # test --assemble
26 test_assemble() {
27 create_with_journal_and_stop
28 if mdadm -A $md0 $dev0 $dev1 $dev2 $dev3
29 then
30 echo >&2 "ERROR should return 1 when journal is missing!"; cat /proc/mdstat ; exit 1;
31 fi
32 mdadm -S $md0
33
34 mdadm -A $md0 $dev0 $dev1 $dev2 $dev3 --force
35 check readonly
36 mdadm -S $md0
37 }
38
39 # test --incremental
40 test_incremental() {
41 create_with_journal_and_stop
42 for d in $dev0 $dev1 $dev2 $dev3
43 do
44 mdadm -I $d
45 done
46 check inactive
47 mdadm -I $dev4
48 check raid5
49 mdadm -S $md0
50
51 # test --incremental with journal missing
52 for d in $dev0 $dev1 $dev2 $dev3
53 do
54 mdadm -I $d
55 done
56 mdadm -R $md0
57 check readonly
58 mdadm -S $md0
59 }
60
61 create_with_journal_and_stop
62 test_assemble
63 test_incremental