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

Fix segfault after _free_vginfo by remembering to remove vginfo from list.

This commit is contained in:
Alasdair Kergon 2008-06-09 16:22:33 +00:00
parent 3a152aea38
commit 80b7fe0e88
2 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.38 -
=================================
Fix segfault after _free_vginfo by remembering to remove vginfo from list.
Tweak detection of invalid fid after changes to PVs in VG in _vg_read.
Revert assuming precommitted metadata is live when activating (unnecessary).
Drop cached metadata for disappearing VG in vgmerge.

12
lib/cache/lvmcache.c vendored
View File

@ -631,11 +631,14 @@ struct device *device_from_pvid(struct cmd_context *cmd, struct id *pvid)
static int _free_vginfo(struct lvmcache_vginfo *vginfo)
{
struct lvmcache_vginfo *primary_vginfo, *vginfo2;
int r = 1;
_free_cached_vgmetadata(vginfo);
if (vginfo_from_vgname(vginfo->vgname, NULL) == vginfo) {
vginfo2 = primary_vginfo = vginfo_from_vgname(vginfo->vgname, NULL);
if (vginfo == primary_vginfo) {
dm_hash_remove(_vgname_hash, vginfo->vgname);
if (vginfo->next && !dm_hash_insert(_vgname_hash, vginfo->vgname,
vginfo->next)) {
@ -643,7 +646,12 @@ static int _free_vginfo(struct lvmcache_vginfo *vginfo)
vginfo->vgname);
r = 0;
}
}
} else do
if (vginfo2->next == vginfo) {
vginfo2->next = vginfo->next;
break;
}
while ((vginfo2 = primary_vginfo->next));
if (vginfo->vgname)
dm_free(vginfo->vgname);