mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
Fix _mda_setup() to not check first mda's size before pe_align rounding.
Without this fix rounding the end of the first mda to a pe_align boundary could silently exceed the disk_size. Final 'if (start1 + mda_size1 > disk_size)' block serves as a safety net. Signed-off-by: Mike Snitzer <snitzer@redhat.com>
This commit is contained in:
parent
2143b169b1
commit
ad273af9c7
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.51 -
|
Version 2.02.51 -
|
||||||
================================
|
================================
|
||||||
|
Fix _mda_setup() to not check first mda's size before pe_align rounding.
|
||||||
Formalize pe_start policy as split between .pv_setup and .pv_write.
|
Formalize pe_start policy as split between .pv_setup and .pv_write.
|
||||||
Document -I option of clvmd in the man page.
|
Document -I option of clvmd in the man page.
|
||||||
Fix configure script to handle multiple clvmd selections.
|
Fix configure script to handle multiple clvmd selections.
|
||||||
|
@ -1214,6 +1214,15 @@ static int _mda_setup(const struct format_type *fmt,
|
|||||||
start1 += (pagesize - mda_adjustment);
|
start1 += (pagesize - mda_adjustment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Round up to pe_align boundary */
|
||||||
|
mda_adjustment = (mda_size1 + start1) % alignment;
|
||||||
|
if (mda_adjustment) {
|
||||||
|
mda_size1 += (alignment - mda_adjustment);
|
||||||
|
/* Revert if it's now too large */
|
||||||
|
if (start1 + mda_size1 > disk_size)
|
||||||
|
mda_size1 -= (alignment - mda_adjustment);
|
||||||
|
}
|
||||||
|
|
||||||
/* Ensure it's not going to be bigger than the disk! */
|
/* Ensure it's not going to be bigger than the disk! */
|
||||||
if (start1 + mda_size1 > disk_size) {
|
if (start1 + mda_size1 > disk_size) {
|
||||||
log_warn("WARNING: metadata area fills disk leaving no "
|
log_warn("WARNING: metadata area fills disk leaving no "
|
||||||
@ -1221,14 +1230,18 @@ static int _mda_setup(const struct format_type *fmt,
|
|||||||
/* Leave some free space for rounding */
|
/* Leave some free space for rounding */
|
||||||
/* Avoid empty data area as could cause tools problems */
|
/* Avoid empty data area as could cause tools problems */
|
||||||
mda_size1 = disk_size - start1 - alignment * 2;
|
mda_size1 = disk_size - start1 - alignment * 2;
|
||||||
/* Only have 1 mda in this case */
|
if (start1 + mda_size1 > disk_size) {
|
||||||
pvmetadatacopies = 1;
|
log_error("Insufficient space for first mda on %s",
|
||||||
|
pv_dev_name(pv));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
/* Round up to pe_align boundary */
|
||||||
/* Round up to pe_align() boundary */
|
|
||||||
mda_adjustment = (mda_size1 + start1) % alignment;
|
mda_adjustment = (mda_size1 + start1) % alignment;
|
||||||
if (mda_adjustment)
|
if (mda_adjustment)
|
||||||
mda_size1 += (alignment - mda_adjustment);
|
mda_size1 += (alignment - mda_adjustment);
|
||||||
|
/* Only have 1 mda in this case */
|
||||||
|
pvmetadatacopies = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* If we already have PEs, avoid overlap */
|
/* If we already have PEs, avoid overlap */
|
||||||
if (pe_start || pe_end) {
|
if (pe_start || pe_end) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user