]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
super1: don't update node nums if it is not more than 1
authorGuoqing Jiang <gqjiang@suse.com>
Wed, 4 May 2016 08:33:44 +0000 (16:33 +0800)
committerJes Sorensen <Jes.Sorensen@redhat.com>
Mon, 9 May 2016 18:59:05 +0000 (14:59 -0400)
We at least need two nodes for cluster raid so make the
check before update node nums.

Reported-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
super1.c

index 8d5543f7b3aa1f01481b0561709b6966e06ee034..972b4700455426d47f52141416d873b6c745fa07 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -2394,6 +2394,11 @@ static int write_bitmap1(struct supertype *st, int fd, enum bitmap_update update
                        return -EINVAL;
                }
 
+               if (bms->version == BITMAP_MAJOR_CLUSTERED && st->nodes <= 1) {
+                       pr_err("Warning: cluster-md at least needs two nodes\n");
+                       return -EINVAL;
+               }
+
                /* Each node has an independent bitmap, it is necessary to calculate the
                 * space is enough or not, first get how many bytes for the total bitmap */
                bm_space_per_node = calc_bitmap_size(bms, 4096);