]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Fix possible bug with bitmap space allocation with v1.0 metadata
authorNeil Brown <neilb@suse.de>
Tue, 29 Apr 2008 07:13:53 +0000 (17:13 +1000)
committerNeil Brown <neilb@suse.de>
Tue, 29 Apr 2008 07:13:53 +0000 (17:13 +1000)
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.

.gitignore [new file with mode: 0644]
md.4
mdadm.conf.5
super1.c

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/md.4 b/md.4
index db39aba66584c46051198c499b64c89deb173e43..fb7267f2fae048070c98c2d4bf37ebcd67a3a7f7 100644 (file)
--- a/md.4
+++ b/md.4
@@ -1,9 +1,9 @@
-''' Copyright Neil Brown and others.
-'''   This program is free software; you can redistribute it and/or modify
-'''   it under the terms of the GNU General Public License as published by
-'''   the Free Software Foundation; either version 2 of the License, or
-'''   (at your option) any later version.
-''' See file COPYING in distribution for details.
+.\" Copyright Neil Brown and others.
+.\"   This program is free software; you can redistribute it and/or modify
+.\"   it under the terms of the GNU General Public License as published by
+.\"   the Free Software Foundation; either version 2 of the License, or
+.\"   (at your option) any later version.
+.\" See file COPYING in distribution for details.
 .TH MD 4
 .SH NAME
 md \- Multiple Device driver aka Linux Software RAID
index 4807055be07026ac40e9d7ce4238d2bac95be178..aadfb23e3f0f515ba57b02c9a976386763115eca 100644 (file)
@@ -1,9 +1,9 @@
-''' Copyright Neil Brown and others.
-'''   This program is free software; you can redistribute it and/or modify
-'''   it under the terms of the GNU General Public License as published by
-'''   the Free Software Foundation; either version 2 of the License, or
-'''   (at your option) any later version.
-''' See file COPYING in distribution for details.
+.\" Copyright Neil Brown and others.
+.\"   This program is free software; you can redistribute it and/or modify
+.\"   it under the terms of the GNU General Public License as published by
+.\"   the Free Software Foundation; either version 2 of the License, or
+.\"   (at your option) any later version.
+.\" See file COPYING in distribution for details.
 .TH MDADM.CONF 5
 .SH NAME
 mdadm.conf \- configuration for management of Software RAID with mdadm
index 887db10c5f4cc6f1e863702c71d606a1c30c21e0..7ea6958ad846475e421ef6e1762db9e141cf50ae 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -905,7 +905,7 @@ static int write_init_super1(struct supertype *st,
         * 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) {
@@ -915,6 +915,8 @@ static int write_init_super1(struct supertype *st,
                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: