[PATCH 1/1] Avoid OOPS when reshaping raid1 to raid0

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

 



From: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>

raid1 arrays do not have the notion of chunk size. Set the existing
chunk size of the new raid0 to the same as the proposed new chunk size
to avoid a divide by zero OOPS when aligning the size of the new array
to that of the chunk size.

Signed-off-by: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>
---
 drivers/md/raid0.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 6f31f55..dff8d6b 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -639,6 +639,14 @@ static void *raid0_takeover_raid1(struct mddev *mddev)
 	mddev->new_level = 0;
 	mddev->new_layout = 0;
 	mddev->new_chunk_sectors = 128; /* by default set chunk size to 64k */
+	mddev->chunk_sectors = 128;	/*
+					 * a raid1 one doesn't have the
+					 * notion of chunk size, so set
+					 * existing chunk_sector to match the
+					 * new size to avoid divide by zero
+					 * when aligning the size of the new
+					 * raid0 to the existing chunk size.
+					 */
 	mddev->delta_disks = 1 - mddev->raid_disks;
 	mddev->raid_disks = 1;
 	/* make sure it will be not marked as dirty */
-- 
1.7.7.6

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