]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Be more careful checking why reshape has stopped.
authorNeilBrown <neilb@suse.de>
Sun, 16 Jan 2011 22:53:25 +0000 (09:53 +1100)
committerNeilBrown <neilb@suse.de>
Sun, 16 Jan 2011 22:53:25 +0000 (09:53 +1100)
If reshape_position reports 'none', check array_state to see if array
is still active.

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

diff --git a/Grow.c b/Grow.c
index 755d3d7c7885a66db8de9fa768d5fade5e7d46c4..7665684733290aa9ebe31372422db9ca764fca4a 100644 (file)
--- a/Grow.c
+++ b/Grow.c
@@ -2423,8 +2423,14 @@ check_progress:
        if (sysfs_get_str(info, NULL, "reshape_position", buf, sizeof(buf)) < 0
            || strncmp(buf, "none", 4) != 0)
                return -2; /* abort */
-       else
+       else {
+               /* Maybe racing with array shutdown - check state */
+               if (sysfs_get_str(info, NULL, "array_state", buf, sizeof(buf)) < 0
+                   || strncmp(buf, "inactive", 8) == 0
+                   || strncmp(buf, "clear",5) == 0)
+                       return -2; /* abort */
                return -1; /* complete */
+       }
 }