]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Grow: be more careful if array is stopped during critical section.
authorNeilBrown <neilb@suse.de>
Thu, 14 May 2015 23:42:39 +0000 (09:42 +1000)
committerNeilBrown <neilb@suse.de>
Fri, 15 May 2015 01:07:25 +0000 (11:07 +1000)
In that case, updating 'completed' to 'max_progress' is wrong.

Signed-off-by: NeilBrown <neilb@suse.de>
Grow.c

diff --git a/Grow.c b/Grow.c
index ec18078495019072316a022c3b5af9409673ed06..99f349731fd43a97178714cdb2648614085a6df5 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -3850,10 +3850,17 @@ int progress_reshape(struct mdinfo *info, struct reshape *reshape,
                        goto check_progress;
        }
        /* Some kernels reset 'sync_completed' to zero,
-        * we need to have real point we are in md
+        * we need to have real point we are in md.
+        * But only if array is actually still reshaping,
+        * not stopped.
         */
-       if (completed == 0)
-               completed = max_progress;
+       if (completed == 0) {
+               char action[20];
+               if (sysfs_get_str(info, NULL, "sync_action",
+                                 action, 20) > 0 &&
+                   strncmp(action, "reshape", 7) == 0)
+                       completed = max_progress;
+       }
 
        /* some kernels can give an incorrectly high 'completed' number */
        completed /= (info->new_chunk/512);