1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 03:27:58 +03:00

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!
This commit is contained in:
Peter Rajnoha 2011-03-02 10:23:29 +00:00
parent 0b100565ae
commit 15b9215534

View File

@ -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);
}
}
}
/*