master - metadata: schedule PV for header rewrite if adding a PV to VG or restoring VG
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=10128c9bd67a027b480e0f0637745f97fb39ecfa Commit: 10128c9bd67a027b480e0f0637745f97fb39ecfa Parent: 2950adc2ab67fd14173807164f9829f5f53cd33c Author: Peter Rajnoha <[email protected]> AuthorDate: Thu Mar 12 14:49:10 2015 +0100 Committer: Peter Rajnoha <[email protected]> CommitterDate: Mon Feb 15 12:44:46 2016 +0100
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.
--- lib/format_text/archiver.c | 10 ++++++++++ lib/metadata/metadata.c | 3 ++- 2 files changed, 12 insertions(+), 1 deletions(-)
lib/format_text/archiver.c +10 -0
@@ -335,6 +335,7 @@ int backup_restore_vg(struct cmd_context *cmd, struct volume_group *vg, int dropstruct 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)) {
lib/metadata/metadata.c +2 -1
@@ -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 ;