Subject: [PATCH 008/009]: raid5: chunk size check in run

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

 



have raid5 check chunk size in run method instead of in md
 raid5.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
Signed-Off-by:raziebe@xxxxxxxxx
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index e4608d6..0c688ee 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4452,7 +4452,15 @@ static int run(mddev_t *mddev)
 	raid5_conf_t *conf;
 	int working_disks = 0;
 	mdk_rdev_t *rdev;
-
+	/*
+	 * chunk-size has to be a power of 2
+	 */
+	if ((1 << ffz(~mddev->chunk_size)) != mddev->chunk_size) {
+		printk(KERN_ERR "%s chunk_size of %d not valid\n",
+			mdname(mddev),
+			mddev->chunk_size);
+		return -EINVAL;
+	}
 	if (mddev->reshape_position != MaxSector) {
 		/* Check that we can continue the reshape.
 		 * Currently only disks can change, it must


--
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