]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Grow.c
Merge branch 'master' of git://github.com/djbw/mdadm into devel-3.0
[thirdparty/mdadm.git] / Grow.c
diff --git a/Grow.c b/Grow.c
index 7083c184c51456b24255cfea9a8af7f5cdc14758..15cec5f103bf874bdb4669a97086dce333089bee 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -809,7 +809,6 @@ 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);
@@ -817,12 +816,14 @@ int Grow_reshape(char *devname, int fd, int quiet, char *backup_file,
                        }
                        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;
+                       if (comp == 0) {
+                               /* Maybe it finished already */
+                               char action[20];
+                               if (sysfs_get_str(sra, NULL, "sync_action",
+                                                 action, 20) > 0 &&
+                                   strncmp(action, "reshape", 7) != 0)
+                                       break;
+                       }
                        sleep(1);
                }