From e3552d738caf606b51e423a20c6f7ff1cbca0800 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Wed, 1 Dec 2010 10:39:28 +0000 Subject: [PATCH] Check result of vginfo_from_vgname Check for some potential internal error. --- WHATS_NEW | 1 + lib/cache/lvmcache.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index 833b8a70d..7dba983ee 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.78 - ==================================== + Add test for existance of orphan vginfo in _lvmcache_update_vgname(). Do a full rescan if some device is missing in read_pvs_in_vg(). Avoid misleading warnings in vgextend --restoremissing in certain cases. Add error path stack traces for _process_mapper_dir(), _create_and_load_v4(). diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c index 60edcec07..35b698664 100644 --- a/lib/cache/lvmcache.c +++ b/lib/cache/lvmcache.c @@ -1083,6 +1083,13 @@ static int _lvmcache_update_vgname(struct lvmcache_info *info, _scanning_in_progress && _vginfo_is_invalid(primary_vginfo)) dm_list_iterate_items_safe(info2, info3, &primary_vginfo->infos) { orphan_vginfo = vginfo_from_vgname(primary_vginfo->fmt->orphan_vg_name, NULL); + if (!orphan_vginfo) { + log_error(INTERNAL_ERROR "Orphan vginfo %s lost from cache.", + primary_vginfo->fmt->orphan_vg_name); + dm_free(vginfo->vgname); + dm_free(vginfo); + return 0; + } _drop_vginfo(info2, primary_vginfo); _vginfo_attach_info(orphan_vginfo, info2); if (info2->mdas.n) -- 2.43.5