master - vgsplit: Fix detection of moved PVs.
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=84aca4201e3588159e75fa8e047e997c2fad13d2 Commit: 84aca4201e3588159e75fa8e047e997c2fad13d2 Parent: eb710cced11a290ebe3e365e3b1cc225920b6b99 Author: Alasdair G Kergon <[email protected]> AuthorDate: Fri Oct 27 21:38:16 2017 +0100 Committer: Alasdair G Kergon <[email protected]> CommitterDate: Fri Oct 27 22:53:43 2017 +0100
vgsplit: Fix detection of moved PVs.
vgsplit shares the vg_rename code so that must only set the PV_MOVED_VG flag introduced in commit 486ed108481cfbe4336f0fa590cbae251188ecc6 ("vgmerge: Fix intermediate metadata corruption") on PVs that moved.
--- WHATS_NEW | 1 + lib/config/config.c | 2 +- lib/metadata/metadata.c | 8 +++++++- tools/vgmerge.c | 1 + 4 files changed, 10 insertions(+), 2 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.176 - =================================== + Fix detection of moved PVs in vgsplit. (2.02.175) Ignore --stripes/--stripesize on RAID takeover Improve used paths for generated systemd units and init shells. Disallow creation of snapshot of mirror/raid subLV (was never supported).
lib/config/config.c +1 -1
@@ -542,7 +542,7 @@ int config_file_read_fd(struct dm_config_tree *cft, struct device *dev,if (checksum_fn && checksum != (checksum_fn (checksum_fn (INITIAL_CRC , (const uint8_t *)fb, size), (const uint8_t *)(fb + size), size2))) { -log_error ("%s: Checksum error" ,dev_name (dev)); +log_error ("%s: Checksum error at offset %" PRIu64,dev_name (dev), (uint64_t ) offset); goto out; }
lib/metadata/metadata.c +7 -1
@@ -512,13 +512,19 @@ int vg_rename(struct cmd_context *cmd, struct volume_group *vg, } dm_list_iterate_items(pvl, &vg->pvs) { +/* Skip if VG didn't change e.g. with vgsplit */ +if (pvl->pv->vg_name && !strcmp (new_name, pvl->pv->vg_name)) +continue ; +if (!(pvl->pv->vg_name =dm_pool_strdup (mem, new_name))) {log_error ("pv->vg_name allocation failed for '%s'" ,pv_dev_name (pvl->pv));return 0 ; } +/* Mark the PVs that still hold metadata with the old VG name */ - pvl->pv->status |=PV_MOVED_VG ; +log_debug_metadata ("Marking PV %s as moved to VG %s" ,dev_name (pvl->pv->dev), new_name); + pvl->pv->status |=PV_MOVED_VG ; }return 1 ;
tools/vgmerge.c +1 -0
@@ -112,6 +112,7 @@ static int _vgmerge_single(struct cmd_context *cmd, const char *vg_name_to,add_pvl_to_vgs (vg_to, pvl); pvl->pv->vg_name =dm_pool_strdup (cmd->mem, vg_to->name);/* Mark the VGs that still hold metadata for the old VG */ +log_debug_metadata ("Marking PV %s as moved to VG %s" ,dev_name (pvl->pv->dev), vg_to->name); pvl->pv->status |=PV_MOVED_VG ; }