From 67f411afc058f0b0cc6bac527db7a062b2f55d96 Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Wed, 2 Mar 2011 10:23:29 +0000 Subject: [PATCH] Use a copy if moving an mda from pv fid to vg fid. We'll destroy the pv fid (with all mdas in it) after merging all pv mdas to a vg in _text_pv_setup fn, hence we need to use a copy here! --- lib/format_text/format-text.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index 77703efe9..c5db2784a 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -1647,7 +1647,7 @@ static int _text_pv_setup(const struct format_type *fmt, const char *pvid = (const char *) (*pv->old_id.uuid ? &pv->old_id : &pv->id); struct lvmcache_info *info; unsigned mda_index; - struct metadata_area *pv_mda; + struct metadata_area *pv_mda, *pv_mda_copy; struct mda_context *pv_mdac; uint64_t pe_count; uint64_t size_reduction = 0; @@ -1659,8 +1659,10 @@ static int _text_pv_setup(const struct format_type *fmt, continue; /* Be sure it's not already in VG's format instance! */ - if (!fid_get_mda_indexed(vg->fid, pvid, ID_LEN, mda_index)) - fid_add_mda(vg->fid, pv_mda, pvid, ID_LEN, mda_index); + if (!fid_get_mda_indexed(vg->fid, pvid, ID_LEN, mda_index)) { + pv_mda_copy = mda_copy(vg->fid->fmt->cmd->mem, pv_mda); + fid_add_mda(vg->fid, pv_mda_copy, pvid, ID_LEN, mda_index); + } } } /*