diff options
-rw-r--r-- | Grow.c | 5 | ||||
-rw-r--r-- | test | 9 | ||||
-rw-r--r-- | tests/07reshape5intr | 33 |
3 files changed, 42 insertions, 5 deletions
@@ -615,7 +615,8 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file, last_block = nstripe * ndata; ostripe = last_block / odata / (ochunk/512) * (ochunk/512); } - printf("mdadm: Need to backup %lluK of critical section..\n", last_block/2); + fprintf(stderr, Name ": Need to backup %lluK of critical " + "section..\n", last_block/2); sra = sysfs_read(fd, 0, GET_COMPONENT|GET_DEVS|GET_OFFSET|GET_STATE| @@ -837,7 +838,7 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file, if (backup_file) unlink(backup_file); - printf(Name ": ... critical section passed.\n"); + fprintf(stderr, Name ": ... critical section passed.\n"); break; } return 0; @@ -67,6 +67,9 @@ done path0=$dev6 path1=$dev7 +echo 2000 > /proc/sys/dev/raid/speed_limit_max +echo 0 > /sys/module/md_mod/parameters/start_ro + if [ " $1" = " setup" ] then trap 0 ; exit 0 fi @@ -95,7 +98,7 @@ check() { grep -s "active $1 " /proc/mdstat > /dev/null || { echo >&2 "ERROR active $1 not found" ; cat /proc/mdstat ; exit 1;} ;; - resync | recovery ) + resync | recovery | reshape) sleep 0.5 grep -s $1 /proc/mdstat > /dev/null || { echo >&2 ERROR no $1 happening; cat /proc/mdstat; exit 1; } @@ -103,14 +106,14 @@ check() { nosync ) sleep 0.5 - if grep -s 're[synccovery]* =' > /dev/null /proc/mdstat ; then + if grep -s -E '(resync|recovery|reshape) =' > /dev/null /proc/mdstat ; then echo >&2 "ERROR resync or recovery is happening!"; cat /proc/mdstat ; exit 1; fi ;; wait ) sleep 0.1 - while grep 're[synccovery]* =' > /dev/null /proc/mdstat + while grep -E '(resync|recovery|reshape|check|repair) =' > /dev/null /proc/mdstat do sleep 2; done ;; diff --git a/tests/07reshape5intr b/tests/07reshape5intr new file mode 100644 index 00000000..e2a3560c --- /dev/null +++ b/tests/07reshape5intr @@ -0,0 +1,33 @@ + +# +# test interrupting and restartign raid5 reshape. +set -x +devs="$dev1" +st=UU +for disks in 2 3 4 5 +do + eval devs=\"$devs \$dev$disks\" + st=U$st + for d in $devs + do dd if=/dev/urandom of=$d bs=1024 || true + done + + $mdadm -CR $md0 -amd -l5 -n$disks --assume-clean $devs + $mdadm $md0 --add $dev6 + echo 20 > /proc/sys/dev/raid/speed_limit_max + $mdadm --grow $md0 -n $[disks+1] + check reshape + check state $st + $mdadm --stop $md0 + $mdadm --assemble $md0 $devs $dev6 + check reshape + echo 2000 > /proc/sys/dev/raid/speed_limit_max + check wait + echo check > /sys/block/md0/md/sync_action + check wait + mm=`cat /sys/block/md0/md/mismatch_cnt` + if [ $mm -gt 0 ] + then echo >&2 "ERROR mismatch_cnt non-zero : $mm" ; exit 1 + fi + $mdadm -S $md0 +done |