Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=44bf9c9a6af2d76d4de04…
Commit: 44bf9c9a6af2d76d4de04b456362abd4ed454ff9
Parent: 82e6b820b84512ffb9f124c5d450c1036e7dd843
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Nov 14 17:08:20 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Nov 14 18:06:42 2019 +0100
cov: fix memleak for duplicate device
For dev_in_device_list() != 0 allocated 'devl' was
actually leaking - so instead allocate 'devl' only
when !dev_in_device_list() and indent code around.
---
lib/cache/lvmcache.c | 29 +++++++++++++++--------------
1 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 99818de..25d110d 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -1952,24 +1952,25 @@ struct lvmcache_info *lvmcache_add(struct labeller *labeller,
strncpy(dev->pvid, pvid_s, sizeof(dev->pvid));
- /*
- * Keep the existing PV/dev in lvmcache, and save the
- * new duplicate in the list of duplicates. After
- * scanning is complete, compare the duplicate devs
- * with those in lvmcache to check if one of the
- * duplicates is preferred and if so switch lvmcache to
- * use it.
- */
-
- if (!(devl = zalloc(sizeof(*devl))))
- return_NULL;
- devl->dev = dev;
-
/* shouldn't happen */
if (dev_in_device_list(dev, &_initial_duplicates))
log_debug_cache("Initial duplicate already in list %s", dev_name(dev));
- else
+ else {
+ /*
+ * Keep the existing PV/dev in lvmcache, and save the
+ * new duplicate in the list of duplicates. After
+ * scanning is complete, compare the duplicate devs
+ * with those in lvmcache to check if one of the
+ * duplicates is preferred and if so switch lvmcache to
+ * use it.
+ */
+
+ if (!(devl = zalloc(sizeof(*devl))))
+ return_NULL;
+ devl->dev = dev;
+
dm_list_add(&_initial_duplicates, &devl->list);
+ }
if (is_duplicate)
*is_duplicate = 1;
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=08f36dd093c708f0d4a4e…
Commit: 08f36dd093c708f0d4a4edd1fd1d84e9a2316313
Parent: 3b05fd4d072d94bfead8c2d188ecf704fe57e2a8
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Nov 11 17:36:58 2019 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Nov 11 22:44:25 2019 +0100
lvextend: fix resizing volumes of different segtype
When resizing 2 volumes like thin-pool and it's metadata and they
would be of a different type - command would be actually expecting
both LVs being of a same segtype - and would throw an error in
case they are different.
This patch fixes is by setting a new segtype from last segment of
2nd. extented device.
Also it fixes the possible 'percentage' extension setup that
might have been used for 'primary' volume - while the 'secondary'
LV always goes with direct size - as we do not support 'percentage'
setup for them
This affects maily usage of thin-pool where the extension of
thin-pool data size may also lead to extension of metadata size.
---
lib/metadata/lv_manip.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index ae103d3..b4daa56 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -5623,6 +5623,8 @@ static struct logical_volume *_lvresize_setup_aux(struct logical_volume *lv,
struct lv_segment *mseg = last_seg(lv);
lp->alloc = lv->alloc;
+ lp->percent = PERCENT_NONE;
+ lp->segtype = mseg->segtype;
lp->mirrors = seg_is_mirrored(mseg) ? lv_mirror_count(lv) : 0;
lp->resizefs = 0;
lp->stripes = lp->mirrors ? mseg->area_count / lp->mirrors : 0;