diff options
-rw-r--r-- | drivers/md/md.c | 3 | ||||
-rw-r--r-- | drivers/md/raid0.c | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index 1e634a68541e..f363135144f6 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -2998,6 +2998,9 @@ rdev_size_store(struct md_rdev *rdev, const char *buf, size_t len) | |||
2998 | } else if (!sectors) | 2998 | } else if (!sectors) |
2999 | sectors = (i_size_read(rdev->bdev->bd_inode) >> 9) - | 2999 | sectors = (i_size_read(rdev->bdev->bd_inode) >> 9) - |
3000 | rdev->data_offset; | 3000 | rdev->data_offset; |
3001 | if (!my_mddev->pers->resize) | ||
3002 | /* Cannot change size for RAID0 or Linear etc */ | ||
3003 | return -EINVAL; | ||
3001 | } | 3004 | } |
3002 | if (sectors < my_mddev->dev_sectors) | 3005 | if (sectors < my_mddev->dev_sectors) |
3003 | return -EINVAL; /* component must fit device */ | 3006 | return -EINVAL; /* component must fit device */ |
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 24b359717a7e..15c8d3505450 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -411,7 +411,8 @@ static sector_t raid0_size(struct mddev *mddev, sector_t sectors, int raid_disks | |||
411 | "%s does not support generic reshape\n", __func__); | 411 | "%s does not support generic reshape\n", __func__); |
412 | 412 | ||
413 | rdev_for_each(rdev, mddev) | 413 | rdev_for_each(rdev, mddev) |
414 | array_sectors += rdev->sectors; | 414 | array_sectors += (rdev->sectors & |
415 | ~(sector_t)(mddev->chunk_sectors-1)); | ||
415 | 416 | ||
416 | return array_sectors; | 417 | return array_sectors; |
417 | } | 418 | } |