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

vgsplit: Fix intermediate metadata corruption.

Changing the VG of a PV uses the same on-disk mechanism as vgrename.
This relies on recognising both the old and new VG names.  Prior to this
patch the vgsplit code incorrectly provided the new VG name twice
instead of the old and new ones.  This lead the low-level mechanism not
to recognise the device as already belonging to a VG and so paying no
attention to the location of its existing metadata, sometimes partly
overwriting it and then later trying to read the corrupt metadata and
issuing a checksum error.
This commit is contained in:
Alasdair G Kergon 2017-09-22 18:02:58 +01:00
parent b0f4e0fcec
commit 8146548d25
3 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.175 - Version 2.02.175 -
====================================== ======================================
Fix metadata corruption in vgsplit intermediate state.
Require LV name with pvmove in a shared VG. Require LV name with pvmove in a shared VG.
Allow shared active mirror LVs with lvmlockd, dlm, and cmirrord. Allow shared active mirror LVs with lvmlockd, dlm, and cmirrord.
Support lvconvert --repair with cache and cachepool volumes. Support lvconvert --repair with cache and cachepool volumes.

View File

@ -448,8 +448,9 @@ static struct raw_locn *_find_vg_rlocn(struct device_area *dev_area,
(isspace(vgnamebuf[len]) || vgnamebuf[len] == '{')) (isspace(vgnamebuf[len]) || vgnamebuf[len] == '{'))
return rlocn; return rlocn;
log_debug_metadata("Volume group name found in metadata does " log_debug_metadata("Volume group name found in metadata on %s at %" PRIu64 " does "
"not match expected name %s.", vgname); "not match expected name %s.",
dev_name(dev_area->dev), dev_area->start + rlocn->offset, vgname);
bad: bad:
if ((info = lvmcache_info_from_pvid(dev_area->dev->pvid, dev_area->dev, 0)) && if ((info = lvmcache_info_from_pvid(dev_area->dev->pvid, dev_area->dev, 0)) &&

View File

@ -705,6 +705,9 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
if (!vg_rename(cmd, vg_to, vg_name_to)) if (!vg_rename(cmd, vg_to, vg_name_to))
goto_bad; goto_bad;
/* Set old VG name so the metadata operations recognise that the PVs are in an existing VG */
vg_to->old_name = vg_from->name;
/* store it on disks */ /* store it on disks */
log_verbose("Writing out updated volume groups"); log_verbose("Writing out updated volume groups");