From 005debfc11b4cbe653503667423df98b64e5be0e Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Mon, 20 Aug 2007 14:14:25 +1000 Subject: Fix problem with add a device to a 1.x array created with older mdadm. When adding new disk to an array, don't reserve so much bitmap space that the disk cannot store the required data. (Needed when 1.x array was created with older mdadm). --- ANNOUNCE-2.6.3 | 0 ChangeLog | 3 +++ crc32.c | 0 crc32.h | 0 super-ddf.c | 0 super1.c | 4 ++++ 6 files changed, 7 insertions(+) create mode 100644 ANNOUNCE-2.6.3 create mode 100644 crc32.c create mode 100644 crc32.h create mode 100644 super-ddf.c diff --git a/ANNOUNCE-2.6.3 b/ANNOUNCE-2.6.3 new file mode 100644 index 0000000..e69de29 diff --git a/ChangeLog b/ChangeLog index 10ddcf0..71d19f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ Changes Prior to this release - allow --write-behind to be set for --grow. + - When adding new disk to an array, don't reserve so much bitmap + space that the disk cannot store the required data. (Needed when + 1.x array was created with older mdadm). Changes Prior to 2.6.2 release - --fail detached and --remove faulty can be used to fail and diff --git a/crc32.c b/crc32.c new file mode 100644 index 0000000..e69de29 diff --git a/crc32.h b/crc32.h new file mode 100644 index 0000000..e69de29 diff --git a/super-ddf.c b/super-ddf.c new file mode 100644 index 0000000..e69de29 diff --git a/super1.c b/super1.c index 0ff11fb..cf46a2f 100644 --- a/super1.c +++ b/super1.c @@ -917,12 +917,16 @@ static int write_init_super1(struct supertype *st, void *sbv, break; case 1: sb->super_offset = __cpu_to_le64(0); + if (4*2 + bm_space + __le64_to_cpu(sb->size) > dsize) + bm_space = dsize - __le64_to_cpu(sb->size) - 4*2; sb->data_offset = __cpu_to_le64(bm_space + 4*2); sb->data_size = __cpu_to_le64(dsize - bm_space - 4*2); break; case 2: sb_offset = 4*2; sb->super_offset = __cpu_to_le64(4*2); + if (4*2 + 4*2 + bm_space + __le64_to_cpu(sb->size) > dsize) + bm_space = dsize - __le64_to_cpu(sb->size) - 4*2 - 4*2; sb->data_offset = __cpu_to_le64(4*2 + 4*2 + bm_space); sb->data_size = __cpu_to_le64(dsize - 4*2 - 4*2 - bm_space ); break; -- cgit