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

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, August 15, 2008 - 11:59 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=dba034...
Commit:     dba034eef2456d2a9f9a76806846c97acf6c3ad1
Parent:     2b25000bf5157c28d8591f03f0575248a8cbd900
Author:     NeilBrown <neilb@suse.de>
AuthorDate: Tue Aug 5 15:54:13 2008 +1000
Committer:  NeilBrown <neilb@suse.de>
CommitDate: Tue Aug 5 15:56:32 2008 +1000

    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: NeilBrown <neilb@suse.de>
---
 drivers/md/md.c    |    5 +++++
 drivers/md/raid5.c |    3 +++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 8d11cd1..6eb9545 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -4639,6 +4639,11 @@ static int update_size(mddev_t *mddev, sector_t num_sectors)
 	 */
 	if (mddev->sync_thread)
 		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) {
 		sector_t avail;
 		avail = rdev->size * 2;
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 40e9396..17e0953 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4446,6 +4446,9 @@ static int raid5_check_reshape(mddev_t *mddev)
 		return -EINVAL; /* Cannot shrink array or change level yet */
 	if (mddev->delta_disks == 0)
 		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.
 	 * We need a minimum of one full stripe,, and for sensible progress
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Fail safely when trying to grow an array with a write-inte ..., Linux Kernel Mailing ..., (Fri Aug 15, 11:59 am)