mdadm/mdadm-2.6.4-519561f7.patch

37 lines
1.1 KiB
Diff

based on
commit 519561f73f7ba987affde8b174d2691bb098439d
Author: Neil Brown <neilb@suse.de>
Date: Tue Apr 29 17:13:53 2008 +1000
Fix possible bug with bitmap space allocation with v1.0 metadata
When adding a device to an array, make sure we don't reserve
so much space for the bitmap that there isn't room for the data.
(minus the roff comments change)
---
super1.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
--- super1.c.orig
+++ super1.c
@@ -903,7 +903,7 @@ static int write_init_super1(struct supe
* for a bitmap.
*/
array_size = __le64_to_cpu(sb->size);
- /* work out how much space we left of a bitmap */
+ /* work out how much space we left for a bitmap */
bm_space = choose_bm_space(array_size);
switch(st->minor_version) {
@@ -913,6 +913,8 @@ static int write_init_super1(struct supe
sb_offset &= ~(4*2-1);
sb->super_offset = __cpu_to_le64(sb_offset);
sb->data_offset = __cpu_to_le64(0);
+ if (sb_offset - bm_space < array_size)
+ bm_space = sb_offset - array_size;
sb->data_size = __cpu_to_le64(sb_offset - bm_space);
break;
case 1: