summaryrefslogtreecommitdiff
path: root/super1.c
diff options
context:
space:
mode:
authorZhilong Liu <zlliu@suse.com>2017-03-01 18:42:33 +0800
committerJes Sorensen <Jes.Sorensen@gmail.com>2017-03-06 16:28:21 -0500
commit9d67f6496c71efbc68b33aea663dbcc1597a0828 (patch)
treec2d2ab60ea2ce7ab3ff49054b96086946d297bac /super1.c
parente93bb91b12b5c8a799a04e314d376da38d007e9d (diff)
downloadmdadm-9d67f6496c71efbc68b33aea663dbcc1597a0828.tar.gz
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 'super1.c')
-rw-r--r--super1.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/super1.c b/super1.c
index 87a74cb..882cd61 100644
--- a/super1.c
+++ b/super1.c
@@ -2380,14 +2380,7 @@ static int write_bitmap1(struct supertype *st, int fd, enum bitmap_update update
}
if (bms->version == BITMAP_MAJOR_CLUSTERED) {
- if (st->nodes == 1) {
- /* the parameter for nodes is not valid */
- pr_err("Warning: cluster-md at least needs two nodes\n");
- return -EINVAL;
- } else if (st->nodes == 0)
- /* --nodes is not specified */
- break;
- else if (__cpu_to_le32(st->nodes) < bms->nodes) {
+ if (__cpu_to_le32(st->nodes) < bms->nodes) {
/* Since the nodes num is not increased, no need to check the space
* is enough or not, just update bms->nodes */
bms->nodes = __cpu_to_le32(st->nodes);