[PATCH v1] mdadm/Build:check the level parameter when build new array

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

 



check if user forgets to specify the --level
when build a new array. such as:
./mdadm -B /dev/md0 -n2 /dev/loop[0-1]

Signed-off-by: Zhilong Liu <zlliu@xxxxxxxx>
---
 Build.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Build.c b/Build.c
index 74a440e..a5fcc06 100644
--- a/Build.c
+++ b/Build.c
@@ -56,6 +56,10 @@ int Build(char *mddev, struct mddev_dev *devlist,
 	int uuid[4] = {0,0,0,0};
 	struct map_ent *map = NULL;
 
+	if (s->level == UnSet) {
+		pr_err("a RAID level is needed to Build an array.\n");
+		return 1;
+	}
 	/* scan all devices, make sure they really are block devices */
 	for (dv = devlist; dv; dv=dv->next) {
 		subdevs++;
-- 
2.10.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