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.
This commit is contained in:
parent
5f98d3cbd9
commit
519561f73f
12
md.4
12
md.4
|
@ -1,9 +1,9 @@
|
||||||
''' Copyright Neil Brown and others.
|
.\" Copyright Neil Brown and others.
|
||||||
''' This program is free software; you can redistribute it and/or modify
|
.\" 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
|
.\" it under the terms of the GNU General Public License as published by
|
||||||
''' the Free Software Foundation; either version 2 of the License, or
|
.\" the Free Software Foundation; either version 2 of the License, or
|
||||||
''' (at your option) any later version.
|
.\" (at your option) any later version.
|
||||||
''' See file COPYING in distribution for details.
|
.\" See file COPYING in distribution for details.
|
||||||
.TH MD 4
|
.TH MD 4
|
||||||
.SH NAME
|
.SH NAME
|
||||||
md \- Multiple Device driver aka Linux Software RAID
|
md \- Multiple Device driver aka Linux Software RAID
|
||||||
|
|
12
mdadm.conf.5
12
mdadm.conf.5
|
@ -1,9 +1,9 @@
|
||||||
''' Copyright Neil Brown and others.
|
.\" Copyright Neil Brown and others.
|
||||||
''' This program is free software; you can redistribute it and/or modify
|
.\" 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
|
.\" it under the terms of the GNU General Public License as published by
|
||||||
''' the Free Software Foundation; either version 2 of the License, or
|
.\" the Free Software Foundation; either version 2 of the License, or
|
||||||
''' (at your option) any later version.
|
.\" (at your option) any later version.
|
||||||
''' See file COPYING in distribution for details.
|
.\" See file COPYING in distribution for details.
|
||||||
.TH MDADM.CONF 5
|
.TH MDADM.CONF 5
|
||||||
.SH NAME
|
.SH NAME
|
||||||
mdadm.conf \- configuration for management of Software RAID with mdadm
|
mdadm.conf \- configuration for management of Software RAID with mdadm
|
||||||
|
|
4
super1.c
4
super1.c
|
@ -905,7 +905,7 @@ static int write_init_super1(struct supertype *st,
|
||||||
* for a bitmap.
|
* for a bitmap.
|
||||||
*/
|
*/
|
||||||
array_size = __le64_to_cpu(sb->size);
|
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);
|
bm_space = choose_bm_space(array_size);
|
||||||
|
|
||||||
switch(st->minor_version) {
|
switch(st->minor_version) {
|
||||||
|
@ -915,6 +915,8 @@ static int write_init_super1(struct supertype *st,
|
||||||
sb_offset &= ~(4*2-1);
|
sb_offset &= ~(4*2-1);
|
||||||
sb->super_offset = __cpu_to_le64(sb_offset);
|
sb->super_offset = __cpu_to_le64(sb_offset);
|
||||||
sb->data_offset = __cpu_to_le64(0);
|
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);
|
sb->data_size = __cpu_to_le64(sb_offset - bm_space);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
|
Loading…
Reference in New Issue