summaryrefslogtreecommitdiffstats
path: root/Build.c
diff options
context:
space:
mode:
authorZhilong Liu <zlliu@suse.com>2017-03-28 15:52:27 +0200
committerJes Sorensen <Jes.Sorensen@gmail.com>2017-03-28 20:26:47 +0200
commit1b4944f3a1e135871437cc33c26539028e6da5d6 (patch)
tree46f5f37c3d57a427c1726e54138d2b6807c37a7d /Build.c
parentRetry HOT_REMOVE_DISK a few times. (diff)
downloadmdadm-1b4944f3a1e135871437cc33c26539028e6da5d6.tar.xz
mdadm-1b4944f3a1e135871437cc33c26539028e6da5d6.zip
mdadm/Build:check the level parameter when build new array
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@suse.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Diffstat (limited to '')
-rw-r--r--Build.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Build.c b/Build.c
index 74a440e7..a5fcc06b 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++;