diff --git a/WHATS_NEW b/WHATS_NEW index 49246ac6a..c932ec558 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,16 +1,22 @@ Version 2.02.78 - ==================================== - Fix memory leak in outf macro error path of _print_vg/lv/pvs/segment(). - Fix missing reset of vg pointer after vg_release() in _vg_read_by_vgid(). - Fix test for empty system_dir string in _init_backup(). - Certain lvconvert invocations are now required to be done in two steps. - Fix missing context desctruction in err path of lvm1 fallback in lvm2_main(). - Fix memory leak in error path of parse_loop_device_name() from dmsetup. - Fix missing dlclose in _init_formats() error path from init_format call. - Fix missing fclose for _umount() in dmeventd snapshot plugin. - Fix out-of-scope variable usage in process_each_lv(). - Fix dm_task_destroy(NULL) call in _node_clear_table() error path. - Fix resource leak in _rm_blks(). + Fix memory leak when VG allocation policy in metadata is invalid. + Ignore unrecognised allocation policy found in metadata instead of aborting. + Factor out tag printing into _out_tags and avoid leaking string buffer. + Remove some unused variables & assignments. + Add missing vg_release calls in _vg_read_by_vgid. +Still to fix: LCK_CACHE/CLUSTER_VG printing/FIXME + Fix test for no system_dir in _init_backup(). + Disallow lvconvert ops that both allocate & free supplied PEs in a single cmd. + Fix liblvm seg_size to give bytes not sectors. + Add functions to look up LV/PV by name/uuid to liblvm. + Free cmd_context if fallback to LVM1 fails in lvm2_main(). + Free device name buffer in dmsetup parse_loop_device_name() error paths. + Close format lib if init_format_fn fails in _init_formats(). + Don't leave /proc/mounts open after dmeventd snapshot event processing. + Fix out-of-scope arg_vgnames use in process_each_lv(). + Remove incorrect dm_task_destroy(NULL) from _node_clear_table() error path. + Add missing closedir in _rm_blks after removing stray LVM1 VG files. Suppress 'No PV label' message when removing several PVs without mdas. Fix default /etc/lvm permissions to be 0755. (2.02.66) diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM index d3af39bd8..9c324798e 100644 --- a/WHATS_NEW_DM +++ b/WHATS_NEW_DM @@ -1,5 +1,6 @@ Version 1.02.59 - ==================================== + Remove superfluous checks for NULL before calling dm_free. Version 1.02.58 - 22nd November 2010 ==================================== diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c index d59fb1684..afeb239b8 100644 --- a/lib/format_text/import_vsn1.c +++ b/lib/format_text/import_vsn1.c @@ -529,8 +529,10 @@ static int _read_lvnames(struct format_instance *fid __attribute__((unused)), } lv->alloc = get_alloc_from_string(cv->v.str); - if (lv->alloc == ALLOC_INVALID) - return_0; + if (lv->alloc == ALLOC_INVALID) { + log_warn("WARNING: Ignoring unrecognised allocation policy %s for LV %s", cv->v.str, lv->name); + lv->alloc = ALLOC_INHERIT; + } } if (!_read_int32(lvn, "read_ahead", &lv->read_ahead)) @@ -660,7 +662,8 @@ static struct volume_group *_read_vg(struct format_instance *fid, return_NULL; /* skip any top-level values */ - for (vgn = cft->root; (vgn && vgn->v); vgn = vgn->sib) ; + for (vgn = cft->root; (vgn && vgn->v); vgn = vgn->sib) + ; if (!vgn) { log_error("Couldn't find volume group in file."); @@ -738,12 +741,14 @@ static struct volume_group *_read_vg(struct format_instance *fid, struct config_value *cv = cn->v; if (!cv || !cv->v.str) { log_error("allocation_policy must be a string."); - return 0; + goto bad; } vg->alloc = get_alloc_from_string(cv->v.str); - if (vg->alloc == ALLOC_INVALID) - return_0; + if (vg->alloc == ALLOC_INVALID) { + log_warn("WARNING: Ignoring unrecognised allocation policy %s for VG %s", cv->v.str, vg->name); + vg->alloc = ALLOC_NORMAL; + } } if (!_read_uint32(vgn, "metadata_copies", &vg->mda_copies)) { diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 743d63301..88a74302c 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -3086,6 +3086,7 @@ void vg_release(struct volume_group *vg) vg->name); dm_pool_destroy(vg->vgmem); + vg->vgmem = NULL; } /* This is only called by lv_from_lvid, which is only called from @@ -3098,7 +3099,7 @@ static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd, { const char *vgname; struct dm_list *vgnames; - struct volume_group *vg = NULL; + struct volume_group *vg; struct lvmcache_vginfo *vginfo; struct str_list *strl; int consistent = 0; @@ -3109,20 +3110,17 @@ static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd, if ((vg = _vg_read(cmd, NULL, vgid, 1, &consistent, precommitted)) && !strncmp((char *)vg->id.uuid, vgid, ID_LEN)) { - - if (!consistent) { + if (!consistent) log_error("Volume group %s metadata is " "inconsistent", vg->name); - } return vg; } vg_release(vg); - vg = NULL; /* reset so memlock goto out is safe */ } /* Mustn't scan if memory locked: ensure cache gets pre-populated! */ if (memlock()) - goto out; + return_NULL; /* FIXME Need a genuine read by ID here - don't vg_read_internal by name! */ /* FIXME Disabled vgrenames while active for now because we aren't @@ -3132,7 +3130,7 @@ static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd, lvmcache_label_scan(cmd, 2); if (!(vgnames = get_vgnames(cmd, 0))) { log_error("vg_read_by_vgid: get_vgnames failed"); - goto out; + return NULL; } dm_list_iterate_items(strl, vgnames) { @@ -3143,18 +3141,17 @@ static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd, if ((vg = _vg_read(cmd, vgname, vgid, 1, &consistent, precommitted)) && !strncmp((char *)vg->id.uuid, vgid, ID_LEN)) { - if (!consistent) { log_error("Volume group %s metadata is " "inconsistent", vgname); - goto out; + vg_release(vg); + return NULL; } return vg; } + vg_release(vg); } -out: - vg_release(vg); return NULL; }