summaryrefslogtreecommitdiffstats
path: root/Grow.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-04-12 00:58:28 -0700
committerDan Williams <dan.j.williams@intel.com>2009-04-12 00:58:28 -0700
commit48924014b02dd0e8046f58a4c6c9a2903a9b1dbd (patch)
tree4623763c272cab1496fff40da3298bfb7507d48c /Grow.c
parent506ffd1e0bd08cc74f5177d4f4db7c66d7724f6a (diff)
downloadmdadm-48924014b02dd0e8046f58a4c6c9a2903a9b1dbd.tar.gz
mdadm-48924014b02dd0e8046f58a4c6c9a2903a9b1dbd.tar.xz
mdadm-48924014b02dd0e8046f58a4c6c9a2903a9b1dbd.zip
Grow: fix hang when reshape completes too fast
For short reshapes the kernel may be done before mdadm can check that progress has passed the critical section. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'Grow.c')
-rw-r--r--Grow.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Grow.c b/Grow.c
index 14e48f5..7083c18 100644
--- a/Grow.c
+++ b/Grow.c
@@ -809,12 +809,20 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
/* wait for reshape to pass the critical region */
while(1) {
unsigned long long comp;
+ char a[20];
+
if (sysfs_get_ll(sra, NULL, "sync_completed", &comp)<0) {
sleep(5);
break;
}
if (comp >= nstripe)
break;
+
+ /* perhaps the entire reshape has completed */
+ if (comp == 0 &&
+ sysfs_get_str(sra, NULL, "sync_action", a, sizeof(a)) == 0 &&
+ strncmp(a, "idle", 4) == 0)
+ break;
sleep(1);
}