From 9f8c06b31c6defabe30dfd3a529a5c90e51c00c6 Mon Sep 17 00:00:00 2001 From: Jonathan Earl Brassow Date: Thu, 7 Apr 2011 21:49:29 +0000 Subject: [PATCH] Thanks to Zdenek Kabelac (kabi) for pointing out that I was using dm_pool_free incorrectly. This check-in fixes that incorrect usage. I've also added a WHATS_NEW line to reflect the changes I made to allow lv_extend to operate on 0 length intrinsically layered LVs (i.e mirrors and RAID). I forgot that in the last commit. --- WHATS_NEW | 1 + lib/metadata/lv_manip.c | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 10b2a647c..3dd332633 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.85 - =================================== + Allow lv_extend() to work on zero length intrinsically layered LVs. Keep the cache content when the exported vg buffer is matching. Extend the set of memory regions, that are not locked to memory. Enhance usability with the valgrind memcheck tool. diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 23b8d754d..7eb43b74c 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -2114,8 +2114,8 @@ static int _lv_insert_empty_sublvs(struct logical_volume *lv, struct logical_volume *sub_lv; uint32_t i; uint64_t status = 0; - char *img_name; - size_t len; + size_t len = strlen(lv->name) + 32; + char img_name[len]; struct lv_segment *mapseg; if (lv->le_count || first_seg(lv)) { @@ -2141,9 +2141,6 @@ static int _lv_insert_empty_sublvs(struct logical_volume *lv, /* * Next, create all of our sub_lv's and link them in. */ - len = strlen(lv->name) + 32; - if (!(img_name = dm_pool_alloc(lv->vg->cmd->mem, len))) - return_0; if (dm_snprintf(img_name, len, "%s%s", lv->name, "_mimage_%d") < 0) return_0; @@ -2157,7 +2154,6 @@ static int _lv_insert_empty_sublvs(struct logical_volume *lv, } dm_list_add(&lv->segments, &mapseg->list); - dm_pool_free(lv->vg->cmd->mem, img_name); return 1; }