mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Fix pvresize to not allow resize if PV has two metadata areas.
If the PV has two metadata areas, second one is located at the end of the device. Do not allow resize of PV or second metadata area can be overwritten. (The check was active only for orphan PVs.)
This commit is contained in:
parent
74f36b9308
commit
df9c7546a2
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.40 -
|
Version 2.02.40 -
|
||||||
================================
|
================================
|
||||||
|
Fix pvresize to not allow resize if PV has two metadata areas.
|
||||||
Fix setting of volume limit count if converting to lvm1 format.
|
Fix setting of volume limit count if converting to lvm1 format.
|
||||||
Fix vgconvert logical volume id metadata validation.
|
Fix vgconvert logical volume id metadata validation.
|
||||||
Fix lvmdump metadata gather option (-m) to work correctly.
|
Fix lvmdump metadata gather option (-m) to work correctly.
|
||||||
|
@ -35,6 +35,8 @@ static int _pv_resize_single(struct cmd_context *cmd,
|
|||||||
struct list mdas;
|
struct list mdas;
|
||||||
const char *pv_name = pv_dev_name(pv);
|
const char *pv_name = pv_dev_name(pv);
|
||||||
const char *vg_name;
|
const char *vg_name;
|
||||||
|
struct lvmcache_info *info;
|
||||||
|
int mda_count = 0;
|
||||||
|
|
||||||
list_init(&mdas);
|
list_init(&mdas);
|
||||||
|
|
||||||
@ -51,13 +53,7 @@ static int _pv_resize_single(struct cmd_context *cmd,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME Create function to test compatibility properly */
|
mda_count = list_size(&mdas);
|
||||||
if (list_size(&mdas) > 1) {
|
|
||||||
log_error("%s: too many metadata areas for pvresize",
|
|
||||||
pv_name);
|
|
||||||
unlock_vg(cmd, vg_name);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
vg_name = pv_vg_name(pv);
|
vg_name = pv_vg_name(pv);
|
||||||
|
|
||||||
@ -87,10 +83,26 @@ static int _pv_resize_single(struct cmd_context *cmd,
|
|||||||
|
|
||||||
pv = pvl->pv;
|
pv = pvl->pv;
|
||||||
|
|
||||||
|
if (!(info = info_from_pvid(pv->dev->pvid, 0))) {
|
||||||
|
unlock_vg(cmd, vg_name);
|
||||||
|
log_error("Can't get info for PV %s in volume group %s",
|
||||||
|
pv_name, vg->name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
mda_count = list_size(&info->mdas);
|
||||||
|
|
||||||
if (!archive(vg))
|
if (!archive(vg))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME Create function to test compatibility properly */
|
||||||
|
if (mda_count > 1) {
|
||||||
|
log_error("%s: too many metadata areas for pvresize", pv_name);
|
||||||
|
unlock_vg(cmd, vg_name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(pv->fmt->features & FMT_RESIZE_PV)) {
|
if (!(pv->fmt->features & FMT_RESIZE_PV)) {
|
||||||
log_error("Physical volume %s format does not support resizing.",
|
log_error("Physical volume %s format does not support resizing.",
|
||||||
pv_name);
|
pv_name);
|
||||||
|
Loading…
Reference in New Issue
Block a user