Skip to contentSkip to conversation

dm-raid-add-md-raid1-support-2.patch

PATCH New Jonathan Brassow 1 participant 1 message Jul 14, 2011 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dm-raid-add-md-raid1-support-2.patch

Correct number of allowed "rebuild" devices in dm-raid

The number of devices that are allowed to be rebuilt in a RAID1 array is n - 1. It is not limited by 'parity_devs' like the other RAIDs.

drivers/md/dm-raid.c +6 -2
Index: linux-2.6/drivers/md/dm-raid.c
===================================================================
@@ -428,8 +428,12 @@ static int parse_raid_params(struct raid
 		}
 
 		if (!strcasecmp(key, "rebuild")) {
-			if (++rebuild_cnt > rs->raid_type->parity_devs) {
-				rs->ti->error = "Too many rebuild drives given";
+			rebuild_cnt++;
+			if (((rs->raid_type->level != 1) &&
+			     (rebuild_cnt > rs->raid_type->parity_devs)) ||
+			    ((rs->raid_type->level == 1) &&
+			     (rebuild_cnt > (rs->md.raid_disks - 1)))) {
+				rs->ti->error = "Too many rebuild devices specified for given RAID type";
 				return -EINVAL;
 			}
 			if (value > rs->md.raid_disks) {