mirror of
git://sourceware.org/git/lvm2.git
synced 2025-09-23 17:44:22 +03:00
Prevent creation of MDA bigger than disk.
This commit is contained in:
@@ -892,6 +892,17 @@ static int _mda_setup(const struct format_type *fmt,
|
|||||||
/* Place mda straight after label area at start of disk */
|
/* Place mda straight after label area at start of disk */
|
||||||
start1 = LABEL_SCAN_SIZE;
|
start1 = LABEL_SCAN_SIZE;
|
||||||
|
|
||||||
|
/* Ensure it's not going to be bigger than the disk! */
|
||||||
|
if (mda_size1 > disk_size) {
|
||||||
|
log_print("Warning: metadata area fills disk %s",
|
||||||
|
dev_name(pv->dev));
|
||||||
|
/* Leave some free space for rounding */
|
||||||
|
/* Avoid empty data area as could cause tools problems */
|
||||||
|
mda_size1 = disk_size - start1 - alignment * 2;
|
||||||
|
/* Only have 1 mda in this case */
|
||||||
|
pvmetadatacopies = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* 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)
|
||||||
|
Reference in New Issue
Block a user