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

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 486ed10848
("vgmerge: Fix intermediate metadata corruption") on PVs that moved.
This commit is contained in:
Alasdair G Kergon 2017-10-27 21:38:16 +01:00
parent eb710cced1
commit 84aca4201e
4 changed files with 10 additions and 2 deletions

View File

@ -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).

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}