summaryrefslogtreecommitdiffstats
path: root/super1.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-03-09 09:59:39 +1100
committerNeilBrown <neilb@suse.de>2009-03-09 09:59:39 +1100
commit9df04a4f3d5112b14958a8611503b77063b64785 (patch)
treeed2476c3b7ee6ce18a54d1ca00b511df9b8dac90 /super1.c
parentbc8544484fac3ebb1c662c171273e1081f5180d8 (diff)
downloadmdadm-9df04a4f3d5112b14958a8611503b77063b64785.tar.gz
mdadm-9df04a4f3d5112b14958a8611503b77063b64785.tar.xz
mdadm-9df04a4f3d5112b14958a8611503b77063b64785.zip
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@suse.de>
Diffstat (limited to 'super1.c')
-rw-r--r--super1.c3
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);