summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2015-05-15 01:42:39 +0200
committerNeilBrown <neilb@suse.de>2015-05-15 03:07:25 +0200
commite0184a0cd0083f6fe3fc0395ab2b9b2909c8d882 (patch)
tree3b7a1b9fa970b1c781fb5c40ba83834242b6aeec
parentGrow: add missing space in message. (diff)
downloadmdadm-e0184a0cd0083f6fe3fc0395ab2b9b2909c8d882.tar.xz
mdadm-e0184a0cd0083f6fe3fc0395ab2b9b2909c8d882.zip
Grow: be more careful if array is stopped during critical section.
In that case, updating 'completed' to 'max_progress' is wrong. Signed-off-by: NeilBrown <neilb@suse.de>
-rw-r--r--Grow.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/Grow.c b/Grow.c
index ec180784..99f34973 100644
--- 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);