From: Neil Brown Date: Mon, 20 Aug 2007 04:14:25 +0000 (+1000) Subject: Fix problem with add a device to a 1.x array created with older mdadm. X-Git-Tag: mdadm-2.6.3~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=005debfc11b4cbe653503667423df98b64e5be0e;p=thirdparty%2Fmdadm.git 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). --- diff --git a/ANNOUNCE-2.6.3 b/ANNOUNCE-2.6.3 new file mode 100644 index 00000000..e69de29b diff --git a/ChangeLog b/ChangeLog index 10ddcf00..71d19f42 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 00000000..e69de29b diff --git a/crc32.h b/crc32.h new file mode 100644 index 00000000..e69de29b diff --git a/super-ddf.c b/super-ddf.c new file mode 100644 index 00000000..e69de29b diff --git a/super1.c b/super1.c index 0ff11fb1..cf46a2f3 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;