master - vgsplit: Fix intermediate metadata corruption.
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8146548d25e9104f0d530d943290d448c1994c0a Commit: 8146548d25e9104f0d530d943290d448c1994c0a Parent: b0f4e0fcec1a50b73fbc4f05bfd2d385895bc3bc Author: Alasdair G Kergon <[email protected]> AuthorDate: Fri Sep 22 18:02:58 2017 +0100 Committer: Alasdair G Kergon <[email protected]> CommitterDate: Fri Sep 22 18:34:34 2017 +0100
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.
--- WHATS_NEW | 1 + lib/format_text/format-text.c | 5 +++-- tools/vgsplit.c | 3 +++ 3 files changed, 7 insertions(+), 2 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.175 - ====================================== + Fix metadata corruption in vgsplit intermediate state. Require LV name with pvmove in a shared VG. Allow shared active mirror LVs with lvmlockd, dlm, and cmirrord. Support lvconvert --repair with cache and cachepool volumes.
lib/format_text/format-text.c +3 -2
@@ -448,8 +448,9 @@ static struct raw_locn *_find_vg_rlocn(struct device_area *dev_area, (isspace(vgnamebuf[len]) || vgnamebuf[len] == '{'))return rlocn; -log_debug_metadata ("Volume group name found in metadata does " -"not match expected name %s." , vgname); +log_debug_metadata ("Volume group name found in metadata on %s at %" PRIu64" does " +"not match expected name %s." , +dev_name (dev_area->dev), dev_area->start + rlocn->offset, vgname); bad: if ((info = lvmcache_info_from_pvid(dev_area->dev->pvid, dev_area->dev, 0)) &&
tools/vgsplit.c +3 -0
@@ -705,6 +705,9 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)if (!vg_rename (cmd, vg_to, vg_name_to)) 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 */ log_verbose ("Writing out updated volume groups" );