1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

metadata: schedule PV for header rewrite if adding a PV to VG or restoring VG

When adding PV to VG, we need to rewrite PV header as there's a flip
in PV_EXT_USED flag. The same applies if we're restoring VG from backup.
This commit is contained in:
Peter Rajnoha 2015-03-12 14:49:10 +01:00
parent 2950adc2ab
commit 10128c9bd6
2 changed files with 12 additions and 1 deletions

View File

@ -335,6 +335,7 @@ int backup_restore_vg(struct cmd_context *cmd, struct volume_group *vg, int drop
struct pv_list *pvl;
struct format_instance *fid;
struct format_instance_ctx fic;
struct pv_to_write *pvw;
uint32_t tmp;
/*
@ -363,6 +364,15 @@ int backup_restore_vg(struct cmd_context *cmd, struct volume_group *vg, int drop
/* Add any metadata areas on the PVs */
dm_list_iterate_items(pvl, &vg->pvs) {
if (pvl->pv->fmt->features & FMT_PV_FLAGS) {
if (!(pvw = dm_pool_zalloc(vg->vgmem, sizeof(*pvw)))) {
log_error("pv_to_write allocation for '%s' failed", pv_dev_name(pvl->pv));
return 0;
}
pvw->pv = pvl->pv;
dm_list_add(&vg->pvs_to_write, &pvw->list);
}
tmp = vg->extent_size;
vg->extent_size = 0;
if (!vg->fid->fmt->ops->pv_setup(vg->fid->fmt, pvl->pv, vg)) {

View File

@ -279,7 +279,8 @@ int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
break;
}
if (pv->status & UNLABELLED_PV) {
if ((pv->fmt->features & FMT_PV_FLAGS) ||
(pv->status & UNLABELLED_PV)) {
if (!(pvw = dm_pool_zalloc(mem, sizeof(*pvw)))) {
log_error("pv_to_write allocation for '%s' failed", pv_name);
return 0;