summaryrefslogtreecommitdiffstats
path: root/mdadm.c
diff options
context:
space:
mode:
authorZhilong Liu <zlliu@suse.com>2017-03-01 11:42:33 +0100
committerJes Sorensen <Jes.Sorensen@gmail.com>2017-03-06 22:28:21 +0100
commit9d67f6496c71efbc68b33aea663dbcc1597a0828 (patch)
treec2d2ab60ea2ce7ab3ff49054b96086946d297bac /mdadm.c
parentmdadm:fix typo in comment (diff)
downloadmdadm-9d67f6496c71efbc68b33aea663dbcc1597a0828.tar.xz
mdadm-9d67f6496c71efbc68b33aea663dbcc1597a0828.zip
mdadm:check the nodes when operate clustered array
It doesn't make sense to write_bitmap with less than 2 nodes, in order to avoid 'write_bitmap' received invalid nodes number, it would be better to do checking nodes in getopt operations. Signed-off-by: Zhilong Liu <zlliu@suse.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Diffstat (limited to 'mdadm.c')
-rw-r--r--mdadm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mdadm.c b/mdadm.c
index 16fd49a7..b5ac0611 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -603,8 +603,8 @@ int main(int argc, char *argv[])
case O(GROW, Nodes):
case O(CREATE, Nodes):
c.nodes = parse_num(optarg);
- if (c.nodes <= 0) {
- pr_err("invalid number for the number of cluster nodes: %s\n",
+ if (c.nodes < 2) {
+ pr_err("clustered array needs two nodes at least: %s\n",
optarg);
exit(2);
}