From: Xiao Ni Date: Tue, 9 Feb 2021 09:39:51 +0000 (+0800) Subject: It should be FAILED when raid has not enough active disks X-Git-Tag: mdadm-4.2-rc1~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=db5377883fef;p=thirdparty%2Fmdadm.git It should be FAILED when raid has not enough active disks It can't remove the disk if there are not enough disks. For example, raid5 can't remove the second disk. If the second disk is unplug from machine, it's better show missing and the raid should be FAILED. It's better for administrator to monitor the raid. Signed-off-by: Xiao Ni Signed-off-by: Jes Sorensen --- diff --git a/Detail.c b/Detail.c index f8dea6fd..cd26fb0f 100644 --- a/Detail.c +++ b/Detail.c @@ -355,9 +355,14 @@ int Detail(char *dev, struct context *c) avail = xcalloc(array.raid_disks, 1); for (d = 0; d < array.raid_disks; d++) { - - if ((disks[d*2].state & (1<prefer); + dv_rep = map_dev_preferred(disks[d*2+1].major, + disks[d*2+1].minor, 0, c->prefer); + + if ((dv && (disks[d*2].state & (1<brief) printf("\n"); }