Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/metadata/metadata.c

PATCH [email protected] 2 participants 2 messages Oct 12, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: wysochanski at sourceware.org 2007-10-12 18:37:19

Modified files:
. : WHATS_NEW
lib/metadata : metadata.c

Log message:
Add _alloc_pv() and _free_pv() from _pv_create() code and fix error paths.

Modified original patch by Jun'ichi Nomura <[email protected]>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.720&r2=1.721
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.138&r2=1.139

WHATS_NEW +2 -1
@@ -1,8 +1,9 @@
 Version 2.02.29 -
 ==================================
+  Add _alloc_pv() and _free_pv() from _pv_create() code and fix error paths.
   Add pv_dev_name() to access PV device name.
   Add const attributes to pv accessor functions.
-  Refactor vg_add_snapshot and lv_create_empty.
+  Refactor vg_add_snapshot() and lv_create_empty().
   Handle new sysfs subsystem/block/devices directory structure.
   Tests are run with LVM_SYSTEM_DIR pointing to private root and /dev dirs.
   Fix a bug in lvm_dump.sh checks for lvm/dmsetup binaries.
lib/metadata/metadata.c +43 -18

99 lines not on this page · raw message

#1 lore raw

Hi Dave,

Thanks for committing the patches to CVS.

I found a comment below:

lib/metadata/metadata.c line 715

Quoted 2 lines · wysochanski at sourceware.org
lib/metadata/metadata.c +2 -0
+	 * FIXME: leak pv->vg_name
+	 * Adding dm_pool_free(mem, pv->vg_name) - causes warning w/'const'

since 'pv->vg_name' is allocated after 'pv' from the same pool, freeing 'pv' will free 'pv->vg_name' as well.
So we don't have to do dm_pool_free(mem, pv->vg_name) here.

However,

lib/metadata/metadata.c line 717

Quoted 2 lines
lib/metadata/metadata.c +2 -0
+	 * Perhaps pv->vg_name should be initialized to ORPHAN, not alloc'd
+	 * memory?

I agree moving pv->vg_name allocation outside of _alloc_pv() is better.

Thanks,

Signature · 1 line
Jun'ichi Nomura, NEC Corporation of America