Skip to content

mdadm:checking level once mode has been set

Zhilong Liu linux-raid 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 9 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4mdadm:bitmap cannot be set twicemdadm.c+4 -01 reply
2/4mdadm:external bitmap only supports ext filesystemCreate.c mdadm.c+16 -52 replies
3/4mdadm:triggers core dump when stat2devnm return NULLMonitor.c lib.c+4 -32 replies
3/4mdadm:triggers core dump when stat2devnm return NULLMonitor.c+6 -10 replies

Reviews trailers per patch

2 of 4 patches have a Reviewed-by or Acked-by.

PatchNeilBrown
1/4
2/4
3/4R-b
3/4R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] mdadm:checking level once mode has been set

mdadm: it would be better to check --level ealier, because it would fall to different prompt if user forgets to specify the --level. such as:
./mdadm -CR /dev/md0 -b internal -n2 -x1 /dev/loop[0-2]

Create.c +0 -4
index 9a951b0..beec29f 100644
@@ -125,10 +125,6 @@ int Create(struct supertype *st, char *mddev,
 	memset(&info, 0, sizeof(info));
 	if (s->level == UnSet && st && st->ss->default_geometry)
 		st->ss->default_geometry(st, &s->level, NULL, NULL);
-	if (s->level == UnSet) {
-		pr_err("a RAID level is needed to create an array.\n");
-		return 1;
-	}
 	if (s->raiddisks < 4 && s->level == 6) {
 		pr_err("at least 4 raid-devices needed for level 6\n");
 		return 1;
mdadm.c +6 -0
index 19a06db..ad24bdf 100644
@@ -350,6 +350,12 @@ int main(int argc, char *argv[])
 				pr_err("Must give -a/--add for devices to add: %s\n", optarg);
 				exit(2);
 			}
+			if (devs_found > 0 && s.level == UnSet && !devmode) {
+				if (mode == CREATE || mode == BUILD) {
+					pr_err("a RAID level is needed to create or build an array.\n");
+					exit(2);
+				}
+			}
 			dv = xmalloc(sizeof(*dv));
 			dv->devname = optarg;
 			dv->disposition = devmode;
Signature · 1 line
2.10.2