From 5e7be8389446a4afa016351e65d1ead31a978f16 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 20 Jan 2014 15:31:45 +1100 Subject: [PATCH] Grow: fix problems with prematurely aborting of reshapes. 1/ when unfreezing, make sure the array is frozen first. If it isn't we might end up interrupting a reshape. 2/ When the child finishes, don't call abort_reshape() as that will interrupt the reshape. Just set suspend_* etc explicitly. Signed-off-by: NeilBrown --- Grow.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Grow.c b/Grow.c index f9f9792..6f556f6 100644 --- a/Grow.c +++ b/Grow.c @@ -612,9 +612,14 @@ static void unfreeze(struct supertype *st) return unfreeze_container(st); else { struct mdinfo *sra = sysfs_read(-1, st->devnm, GET_VERSION); + char buf[20]; - if (sra) + if (sra && + sysfs_get_str(sra, NULL, "sync_action", buf, 20) > 0 + && strcmp(buf, "frozen\n") == 0) { + printf("unfreeze\n"); sysfs_set_str(sra, NULL, "sync_action", "idle"); + } sysfs_free(sra); } } @@ -2666,7 +2671,7 @@ static int impose_level(int fd, int level, char *devname, int verbose) for (d = 0, found = 0; d < MAX_DISKS && found < array.nr_disks; d++) { - mdu_disk_info_t disk; + mdu_disk_info_t disk; disk.number = d; if (ioctl(fd, GET_DISK_INFO, &disk) < 0) continue; @@ -4316,7 +4321,12 @@ int child_monitor(int afd, struct mdinfo *sra, struct reshape *reshape, } /* FIXME maybe call progress_reshape one more time instead */ - abort_reshape(sra); /* remove any remaining suspension */ + /* remove any remaining suspension */ + sysfs_set_num(sra, NULL, "suspend_lo", 0x7FFFFFFFFFFFFFFFULL); + sysfs_set_num(sra, NULL, "suspend_hi", 0); + sysfs_set_num(sra, NULL, "suspend_lo", 0); + sysfs_set_num(sra, NULL, "sync_min", 0); + if (reshape->before.data_disks == reshape->after.data_disks) sysfs_set_num(sra, NULL, "sync_speed_min", speed); free(buf);