summaryrefslogtreecommitdiff
path: root/Monitor.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2013-05-01 10:23:40 +1000
committerNeilBrown <neilb@suse.de>2013-05-01 10:23:40 +1000
commit276be5147ed1ff80a380b50a34ae83f8a1f21b8e (patch)
treeb65cb0415f6b2e03566698a3dcc45fc2441419f2 /Monitor.c
parent79b2ed4f243b4ac59b4985f513b87dcde4fa6b8f (diff)
Wait: also wait if an action is about to start.
If a sync/recover action is about to start but hasn't actually begun yet, /proc/mdstat won't show it, but md/sync_action will (it checks MD_RECOVERY_NEEDED). So when /proc/mdstat seems to say nothing is happening, double check with md/sync_action. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Monitor.c')
-rw-r--r--Monitor.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/Monitor.c b/Monitor.c
index 607d3ddd..b82e7b6a 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -972,6 +972,19 @@ int Wait(char *dev)
if (strcmp(e->devnm, devnm) == 0)
break;
+ if (e->percent == RESYNC_NONE) {
+ /* We could be in the brief pause before something
+ * starts. /proc/mdstat doesn't show that, but
+ * sync_action does.
+ */
+ struct mdinfo mdi;
+ char buf[21];
+ sysfs_init(&mdi, -1, devnm);
+ if (sysfs_get_str(&mdi, NULL, "sync_action",
+ buf, 20) > 0 &&
+ strcmp(buf,"idle\n") != 0)
+ e->percent = RESYNC_UNKNOWN;
+ }
if (!e || e->percent == RESYNC_NONE) {
if (e && e->metadata_version &&
strncmp(e->metadata_version, "external:", 9) == 0) {