NeilBrown: super1: make sure max_dev grows enough when adding a device to an array.

Martin F. Krafft madduck at alioth.debian.org
Sat Apr 25 17:45:07 UTC 2009


Module: mdadm
Branch: build
Commit: 9df04a4f3d5112b14958a8611503b77063b64785
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=9df04a4f3d5112b14958a8611503b77063b64785

Author: NeilBrown <neilb at suse.de>
Date:   Mon Mar  9 09:59:39 2009 +1100

super1: make sure max_dev grows enough when adding a device to an array.

There was a few kernel releases where the kernel would shrink max_dev
to be just enough to hold the current number of devices.
More recent kernels never shrink it.
However to be as compatible as possible, if we notice that
max_dev is too small to successfully add a device, increase it.

Signed-off-by: NeilBrown <neilb at suse.de>

---

 super1.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/super1.c b/super1.c
index 1eb88aa..1342412 100644
--- a/super1.c
+++ b/super1.c
@@ -795,6 +795,9 @@ static void add_to_super1(struct supertype *st, mdu_disk_info_t *dk)
 		*rp = 0xffff;
 	else
 		*rp = 0xfffe;
+	if (dk->number >= __le32_to_cpu(sb->max_dev) &&
+	    __le32_to_cpu(sb->max_dev) < 384)
+		sb->max_dev = __cpu_to_le32(dk->number+1);
 }
 
 static void locate_bitmap1(struct supertype *st, int fd);




More information about the pkg-mdadm-commits mailing list