diff options
author | Tomasz Majchrzak <tomasz.majchrzak@intel.com> | 2017-05-31 12:46:57 +0200 |
---|---|---|
committer | Jes Sorensen <jsorensen@fb.com> | 2017-06-05 17:11:36 +0200 |
commit | b13b52c80f3d9e3184ea1d6d39aa7053ef7bae49 (patch) | |
tree | 73eaea57c092420f3886fdb6fb4a341424e9c17b /Incremental.c | |
parent | Grow: set component size prior to array size (diff) | |
download | mdadm-b13b52c80f3d9e3184ea1d6d39aa7053ef7bae49.tar.xz mdadm-b13b52c80f3d9e3184ea1d6d39aa7053ef7bae49.zip |
Get failed disk count from array state
Recent commit has changed the way failed disks are counted. It breaks
recovery for external metadata arrays as failed disks are not part of
the array and have no corresponding entries is sysfs (they are only
reported for containers) so degraded arrays show no failed disks.
Recent commit overwrites GET_DEGRADED result prior to GET_STATE and it
is not set again if GET_STATE has not been requested. As GET_STATE
provides the same information as GET_DEGRADED, the latter is not needed
anymore. Remove GET_DEGRADED option and replace it with GET_STATE
option.
Don't count number of failed disks looking at sysfs entries but
calculate it at the end. Do it only for arrays as containers report
no disks, just spares.
Signed-off-by: Tomasz Majchrzak <tomasz.majchrzak@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to 'Incremental.c')
-rw-r--r-- | Incremental.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/Incremental.c b/Incremental.c index 30dc7a2f..6cf21742 100644 --- a/Incremental.c +++ b/Incremental.c @@ -886,16 +886,10 @@ static int array_try_spare(char *devname, int *dfdp, struct dev_policy *pol, } sra = sysfs_read(-1, mp->devnm, GET_DEVS|GET_OFFSET|GET_SIZE|GET_STATE| - GET_DEGRADED|GET_COMPONENT|GET_VERSION); - if (!sra) { - /* Probably a container - no degraded info */ - sra = sysfs_read(-1, mp->devnm, - GET_DEVS|GET_OFFSET|GET_SIZE|GET_STATE| - GET_COMPONENT|GET_VERSION); - if (sra) - sra->array.failed_disks = -1; - } - if (!sra) + GET_COMPONENT|GET_VERSION); + if (sra) + sra->array.failed_disks = -1; + else continue; if (st == NULL) { int i; |