diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | Detail.c | 18 | ||||
-rw-r--r-- | mdadm.8 | 3 |
3 files changed, 17 insertions, 6 deletions
@@ -8,6 +8,8 @@ Changes Prior to this release - Various manpage updates. - Make "--grow --add" for linear arrays really work. - --auto-detect to trigger in-kernel autodetect. + - Make return code for "--detail --test" more reliable. Missing + devices as well as failed devices cause an error. Changes Prior to 2.6.1 release - --monitor was producing some meaningless warnings due to a bug. @@ -58,6 +58,8 @@ int Detail(char *dev, int brief, int export, int test, char *homehost) void *super = NULL; int rv = test ? 4 : 1; + int avail_disks = 0; + char *avail; if (fd < 0) { fprintf(stderr, Name ": cannot open %s: %s\n", @@ -301,6 +303,7 @@ This is pretty boring disks[next++] = disk; } + avail = calloc(array.raid_disks, 1); for (d= 0; d < max_disks; d++) { char *dv; mdu_disk_info_t disk = disks[d]; @@ -347,10 +350,13 @@ This is pretty boring } } if (disk.state == 0) spares++; - if (test && d < array.raid_disks && disk.state & (1<<MD_DISK_FAULTY)) { - if ((rv & 1) && (array.level ==4 || array.level == 5)) - rv |= 2; + if (test && d < array.raid_disks + && !(disk.state & (1<<MD_DISK_SYNC))) rv |= 1; + if (d < array.raid_disks + && (disk.state & (1<<MD_DISK_SYNC))) { + avail_disks ++; + avail[d] = 1; } if ((dv=map_dev(disk.major, disk.minor, 0))) { if (brief) { @@ -372,7 +378,11 @@ This is pretty boring if (brief > 1 && devices) printf("\n devices=%s", devices); if (brief) printf("\n"); out: - if (test && (rv&2)) rv &= ~1; + if (test && + !enough(array.level, array.raid_disks, array.layout, + 1, avail, avail_disks)) + rv = 2; + close(fd); return rv; } @@ -1457,8 +1457,7 @@ The array is functioning normally. The array has at least one failed device. .TP 2 -The array has multiple failed devices and hence is unusable (raid4 or -raid5). +The array has multiple failed devices such that it is unusable. .TP 4 There was an error while trying to get information about the device. |