[PATCH 10/14] imsm: add maximum number of disk validation in RAID array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>From 6f52514bf9ab085b55420bf374abf8069cd981d8 Mon Sep 17 00:00:00 2001
From: Marcin Labun <marcin.labun@xxxxxxxxx>
Date: Thu, 3 Mar 2011 15:27:10 +0100
Subject: [PATCH 10/14] imsm: add maximum number of disk validation in RAID array

Arrays exceeding the OROM/EFI maximum number of supported disk are
blocked in validate_geometry_imsm_orom function.

Signed-off-by: Marcin Labun <marcin.labun@xxxxxxxxx>
---
 super-intel.c |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index 2539efd..b9f8c9c 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -4229,12 +4229,30 @@ static int is_raid_level_supported(const struct imsm_orom *orom, int level, int
 	return 0;
 }
 
+
 #define pr_vrb(fmt, arg...) (void) (verbose && fprintf(stderr, Name fmt, ##arg))
+/*
+ * validate volume parameters with OROM/EFI capabilities
+ */
 static int
 validate_geometry_imsm_orom(struct intel_super *super, int level, int layout,
 			    int raiddisks, int *chunk, int verbose)
 {
-	if (!is_raid_level_supported(super->orom, level, raiddisks)) {
+#if DEBUG
+	verbose = 1;
+#endif
+	/* validate container capabilities */
+	if (super->orom && raiddisks > super->orom->tds) {
+		if (verbose)
+			fprintf(stderr, Name ": %d exceeds maximum number of"
+				" platform supported disks: %d\n",
+				raiddisks, super->orom->tds);
+		return 0;
+	}
+
+        /* capabilities of OROM tested - copied from validate_geometry_imsm_volume */
+	if (super->orom && (!is_raid_level_supported(super->orom, level,
+						     raiddisks))) {
 		pr_vrb(": platform does not support raid%d with %d disk%s\n",
 			level, raiddisks, raiddisks > 1 ? "s" : "");
 		return 0;
@@ -4258,7 +4276,6 @@ validate_geometry_imsm_orom(struct intel_super *super, int level, int layout,
 				layout, level);
 		return 0;
 	}
-
 	return 1;
 }
 
@@ -4856,7 +4873,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st, char *subarra
 						 get_imsm_raid_level(map), /* RAID level */
 						 imsm_level_to_layout(get_imsm_raid_level(map)),
 						 map->num_members, /* raid disks */
-						 chunk,
+						 &chunk,
 						 1 /* verbose */)) {
 			fprintf(stderr, Name ": RAID gemetry validation failed. "
 				"Cannot proceed with the action(s).\n");
-- 
1.6.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux