]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Assemble: allow a RAID4 to assemble easily when parity devices is missing.
authorNeilBrown <neilb@suse.de>
Tue, 7 Apr 2015 23:36:55 +0000 (09:36 +1000)
committerNeilBrown <neilb@suse.de>
Tue, 7 Apr 2015 23:39:02 +0000 (09:39 +1000)
If the parity device of a RAID4 is missing, then there is no immediate
risk to data.  So it doesn't matter if the array is dirty or not.

This can be important when reshaping a RAID0, and is a much better
solution that that in the resent-reverted.
   b720636a5849397dbc6dc1b0f0b671d17034a28b

Reported-by: "Jonathan Harker (Jesusaurus)" <jesusaurus@gentlydownthe.net>
Signed-off-by: NeilBrown <neilb@suse.de>
util.c

diff --git a/util.c b/util.c
index 6f1e2b102c812cee133909ad2c5ee86fc7c70f44..cc98d3badb33053d95532f719405e1e7548a668d 100644 (file)
--- a/util.c
+++ b/util.c
@@ -368,6 +368,13 @@ int enough(int level, int raid_disks, int layout, int clean, char *avail)
        case 1:
                return avail_disks >= 1;
        case 4:
+               if (avail_disks == raid_disks - 1 &&
+                   !avail[raid_disks - 1])
+                       /* If just the parity device is missing, then we
+                        * have enough, even if not clean
+                        */
+                       return 1;
+               /* FALL THROUGH */
        case 5:
                if (clean)
                        return avail_disks >= raid_disks-1;