From: NeilBrown Date: Sun, 16 Jan 2011 22:53:25 +0000 (+1100) Subject: Be more careful checking why reshape has stopped. X-Git-Tag: mdadm-3.2~77 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d5316f66aed11f464d115a9dead4b15ec2bb246;p=thirdparty%2Fmdadm.git Be more careful checking why reshape has stopped. If reshape_position reports 'none', check array_state to see if array is still active. Signed-off-by: NeilBrown --- diff --git a/Grow.c b/Grow.c index 755d3d7c..76656847 100644 --- 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 */ + } }