[PATCH 2/2] super1: don't update node nums if it is not more than 1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We at least need two nodes for cluster raid so make the
check before update node nums.

Reported-by: Zhilong Liu <zlliu@xxxxxxxx>
Signed-off-by: Guoqing Jiang <gqjiang@xxxxxxxx>
---
 super1.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/super1.c b/super1.c
index 8d5543f..972b470 100644
--- 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);
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux