mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
pvcreate: fix ignored --dataalignment/dataalignment offset for pvcreate --restorefile
There were two bugs before when using pvcreate --restorefile together with data alignment and its offset specified: - the --dataalignment was always ignored due to missing braces in the code when validating the divisibility of supplied --dataalignment argument with pe_start which we're just restoring: if (pp->rp.pe_start % pp->data_alignment) log_warn("WARNING: Ignoring data alignment %" PRIu64 " incompatible with --restorefile value (%" PRIu64").", pp->data_alignment, pp->rp.pe_start); pp->data_alignment = 0 The pp->data_alignment should be zeroed only if the pe_start is not divisible with data_alignment. - the check for compatibility of restored pe_start was incorrect too since it did not properly count with the dataalignmentoffset that could be supplied together with dataalignment The proper formula is: X * dataalignment + dataalignmentoffset == pe_start So it should be: if ((pp->rp.pe_start % pp->data_alignment) != pp->data_alignment_offset) { ...ignore supplied dataalignment and dataalignment offset... }
This commit is contained in:
parent
b45d2768a8
commit
6c79556f4f
@ -1,5 +1,6 @@
|
||||
Version 2.02.106 -
|
||||
====================================
|
||||
Fix ignored --dataalignment/dataalignment offset for pvcreate --restorefile.
|
||||
Fix lost information about bootloader area when using lvmetad.
|
||||
Don't require --major to be specified when using -My option on kernels > 2.4.
|
||||
Add configure --disable-thin_check_needs_check to support old thin_check.
|
||||
|
@ -1580,14 +1580,6 @@ int pvcreate_params_validate(struct cmd_context *cmd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pp->data_alignment && pp->rp.pe_start != PV_PE_START_CALC) {
|
||||
if (pp->rp.pe_start % pp->data_alignment)
|
||||
log_warn("WARNING: Ignoring data alignment %" PRIu64
|
||||
" incompatible with --restorefile value (%"
|
||||
PRIu64").", pp->data_alignment, pp->rp.pe_start);
|
||||
pp->data_alignment = 0;
|
||||
}
|
||||
|
||||
if (arg_sign_value(cmd, dataalignmentoffset_ARG, SIGN_NONE) == SIGN_MINUS) {
|
||||
log_error("Physical volume data alignment offset may not be negative");
|
||||
return 0;
|
||||
@ -1599,11 +1591,15 @@ int pvcreate_params_validate(struct cmd_context *cmd,
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (pp->data_alignment_offset && pp->rp.pe_start != PV_PE_START_CALC) {
|
||||
log_warn("WARNING: Ignoring data alignment offset %" PRIu64
|
||||
" incompatible with --restorefile value (%"
|
||||
PRIu64").", pp->data_alignment_offset, pp->rp.pe_start);
|
||||
pp->data_alignment_offset = 0;
|
||||
if ((pp->data_alignment + pp->data_alignment_offset) &&
|
||||
(pp->rp.pe_start != PV_PE_START_CALC)) {
|
||||
if ((pp->rp.pe_start % pp->data_alignment) != pp->data_alignment_offset) {
|
||||
log_warn("WARNING: Ignoring data alignment %" PRIu64
|
||||
" incompatible with restored pe_start value %" PRIu64").",
|
||||
pp->data_alignment + pp->data_alignment_offset, pp->rp.pe_start);
|
||||
pp->data_alignment = 0;
|
||||
pp->data_alignment_offset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (arg_sign_value(cmd, metadatasize_ARG, SIGN_NONE) == SIGN_MINUS) {
|
||||
|
Loading…
Reference in New Issue
Block a user