summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2017-10-27 21:38:16 +0100
committerAlasdair G Kergon <agk@redhat.com>2017-10-27 22:53:43 +0100
commit84aca4201e3588159e75fa8e047e997c2fad13d2 (patch)
tree61e57093a6712d02fd8f4925d464cd48d27b4685
parenteb710cced11a290ebe3e365e3b1cc225920b6b99 (diff)
downloadlvm2-84aca4201e3588159e75fa8e047e997c2fad13d2.tar.gz
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.
-rw-r--r--WHATS_NEW1
-rw-r--r--lib/config/config.c2
-rw-r--r--lib/metadata/metadata.c8
-rw-r--r--tools/vgmerge.c1
4 files changed, 10 insertions, 2 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index fbf8732fa..3e13d8c6e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -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).
diff --git a/lib/config/config.c b/lib/config/config.c
index 1f1896922..e8e330bf8 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -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;
}
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index bcc23bc1c..2a9819da6 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -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;
diff --git a/tools/vgmerge.c b/tools/vgmerge.c
index 86c6a48a2..013bef47d 100644
--- a/tools/vgmerge.c
+++ b/tools/vgmerge.c
@@ -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;
}