From 9df04a4f3d5112b14958a8611503b77063b64785 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 9 Mar 2009 09:59:39 +1100 Subject: 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 --- super1.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'super1.c') 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); -- cgit v1.2.1