diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index 5718ab7ec..581cd420e 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.141 - =============================== + dm_get_status_raid() handle better some incosistent md statuses. Accept truncated files in calls to dm_stats_update_regions_from_fd(). Restore Warning by 5% increment when thin-pool is over 80% (1.02.138). diff --git a/libdm/libdm-targets.c b/libdm/libdm-targets.c index 1709c2b2c..6577f0744 100644 --- a/libdm/libdm-targets.c +++ b/libdm/libdm-targets.c @@ -99,6 +99,7 @@ int dm_get_status_raid(struct dm_pool *mem, const char *params, unsigned num_fields; const char *p, *pp, *msg_fields = ""; struct dm_status_raid *s = NULL; + unsigned a = 0; if ((num_fields = _count_fields(params)) < 4) goto_bad; @@ -168,6 +169,23 @@ int dm_get_status_raid(struct dm_pool *mem, const char *params, out: *status = s; + if (s->insync_regions == s->total_regions) { + /* FIXME: kernel gives misleading info here + * Trying to recognize a true state */ + while (i-- > 0) + if (s->dev_health[i] == 'a') + a++; /* Count number of 'a' */ + + if (a && a < s->dev_count) { + /* SOME legs are in 'a' */ + if (!strcasecmp(s->sync_action, "recover") + || !strcasecmp(s->sync_action, "idle")) + /* Kernel may possibly start some action + * in near-by future, do not report 100% */ + s->insync_regions--; + } + } + return 1; bad: