Commit dba034ee authored by NeilBrown's avatar NeilBrown

Fail safely when trying to grow an array with a write-intent bitmap.

We cannot currently change the size of a write-intent bitmap.
So if we change the size of an array which has such a bitmap, it
tries to set bits beyond the end of the bitmap.

For now, simply reject any request to change the size of an array
which has a bitmap.  mdadm can remove the bitmap and add a new one
after the array has changed size.
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 2b25000b
...@@ -4639,6 +4639,11 @@ static int update_size(mddev_t *mddev, sector_t num_sectors) ...@@ -4639,6 +4639,11 @@ static int update_size(mddev_t *mddev, sector_t num_sectors)
*/ */
if (mddev->sync_thread) if (mddev->sync_thread)
return -EBUSY; return -EBUSY;
if (mddev->bitmap)
/* Sorry, cannot grow a bitmap yet, just remove it,
* grow, and re-add.
*/
return -EBUSY;
rdev_for_each(rdev, tmp, mddev) { rdev_for_each(rdev, tmp, mddev) {
sector_t avail; sector_t avail;
avail = rdev->size * 2; avail = rdev->size * 2;
......
...@@ -4446,6 +4446,9 @@ static int raid5_check_reshape(mddev_t *mddev) ...@@ -4446,6 +4446,9 @@ static int raid5_check_reshape(mddev_t *mddev)
return -EINVAL; /* Cannot shrink array or change level yet */ return -EINVAL; /* Cannot shrink array or change level yet */
if (mddev->delta_disks == 0) if (mddev->delta_disks == 0)
return 0; /* nothing to do */ return 0; /* nothing to do */
if (mddev->bitmap)
/* Cannot grow a bitmap yet */
return -EBUSY;
/* Can only proceed if there are plenty of stripe_heads. /* Can only proceed if there are plenty of stripe_heads.
* We need a minimum of one full stripe,, and for sensible progress * We need a minimum of one full stripe,, and for sensible progress
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment