LVM2 ./WHATS_NEW lib/format1/format1.c lib/for ...
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac at sourceware.org 2012-02-13 11:04:00
Modified files:
. : WHATS_NEW
lib/format1 : format1.c
lib/format_pool: format_pool.c
lib/format_text: format-text.c
lib/metadata : metadata.c vg.c vg.h
tools : pvcreate.c vgconvert.c
Log message:
Add free_orphan_vg
Move commod code to destroy orphan VG into free_orphan_vg() function. Use orphan vgmem for creation of PV lists.
Remove some free_pv_fid() calls (FIXME: check all of them)
FIXME: Check whether we could merge release_vg back again for all VGs.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2285&r2=1.2286
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/format1.c.diff?cvsroot=lvm2&r1=1.145&r2=1.146
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_pool/format_pool.c.diff?cvsroot=lvm2&r1=1.49&r2=1.50
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.191&r2=1.192
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.483&r2=1.484
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/vg.c.diff?cvsroot=lvm2&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/vg.h.diff?cvsroot=lvm2&r1=1.17&r2=1.18
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvcreate.c.diff?cvsroot=lvm2&r1=1.97&r2=1.98
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgconvert.c.diff?cvsroot=lvm2&r1=1.51&r2=1.52
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.92 - ==================================== + Add free_orphan_vg. Skip pv/vg_set_fid processing if the fid is same. Check for foreach loop errors in _vg_read_orphans() (2.02.91). Clean error paths for format instance creation (2.02.91).
lib/format1/format1.c +2 -6
@@ -546,12 +546,8 @@static void _format1_destroy (struct format_type *fmt) { -/* FIXME out of place, but the main (cmd) pool has been already -* destroyed and touching the fid (also via release_vg) will crash the -* program */ -dm_hash_destroy (fmt->orphan_vg->hostnames); -dm_pool_destroy (fmt->orphan_vg->fid->mem); -dm_pool_destroy (fmt->orphan_vg->vgmem); +if (fmt->orphan_vg) +free_orphan_vg (fmt->orphan_vg);dm_free (fmt); }
lib/format_pool/format_pool.c +2 -6
@@ -259,12 +259,8 @@static void _pool_destroy (struct format_type *fmt) { -/* FIXME out of place, but the main (cmd) pool has been already -* destroyed and touching the fid (also via release_vg) will crash the -* program */ -dm_hash_destroy (fmt->orphan_vg->hostnames); -dm_pool_destroy (fmt->orphan_vg->fid->mem); -dm_pool_destroy (fmt->orphan_vg->vgmem); +if (fmt->orphan_vg) +free_orphan_vg (fmt->orphan_vg);dm_free (fmt); }
lib/format_text/format-text.c +2 -7
@@ -1541,13 +1541,8 @@static void _text_destroy (struct format_type *fmt) { -/* FIXME out of place, but the main (cmd) pool has been already -* destroyed and touching the fid (also via release_vg) will crash the -* program */ -dm_hash_destroy (fmt->orphan_vg->fid->metadata_areas_index); -dm_hash_destroy (fmt->orphan_vg->hostnames); -dm_pool_destroy (fmt->orphan_vg->fid->mem); -dm_pool_destroy (fmt->orphan_vg->vgmem); +if (fmt->orphan_vg) +free_orphan_vg (fmt->orphan_vg);if (fmt->private) {_free_dirs (&((struct mda_lists *) fmt->private)->dirs);
lib/metadata/metadata.c +6 -5
@@ -1551,7 +1551,6 @@return pv; bad: -free_pv_fid (pv);return NULL ; }
@@ -1575,6 +1574,7 @@/** * pv_create - initialize a physical volume for use with a volume group +* created PV belongs to Orphan VG. * * @fmt: format type * @dev: PV device to initialize
@@ -1609,9 +1609,10 @@ unsigned metadataignore) {const struct format_type *fmt = cmd->fmt; -struct dm_pool *mem = fmt->cmd->mem; +struct dm_pool *mem = fmt->orphan_vg->vgmem;struct physical_volume *pv =_alloc_pv (mem, dev);unsigned mda_index; +struct pv_list *pvl;if (!pv) return_NULL;
@@ -1650,7 +1651,6 @@ goto bad; } -struct pv_list *pvl;if (!(pvl =dm_pool_zalloc (mem,sizeof (*pvl)))) {log_error ("pv_list allocation in pv_create failed" ); goto bad;
@@ -1687,8 +1687,9 @@return pv; bad: -free_pv_fid (pv); -dm_pool_free (mem, pv); +// FIXME: detach from orphan in error path +//free_pv_fid(pv); +//dm_pool_free(mem, pv); return NULL ; }
lib/metadata/vg.c +12 -0
@@ -90,6 +90,18 @@_free_vg (vg); } +/* +* FIXME out of place, but the main (cmd) pool has been already +* destroyed and touching the fid (also via release_vg) will crash the +* program +* +* For now quick wrapper to allow destroy of orphan vg +*/ +void free_orphan_vg (struct volume_group *vg) +{ +_free_vg (vg); +} +char *vg_fmt_dup (const struct volume_group *vg) {if (!vg->fid || !vg->fid->fmt)
lib/metadata/vg.h +1 -0
@@ -121,6 +121,7 @@* by vg_create() or vg_read_internal() to free it when no longer required. */ void release_vg (struct volume_group *vg); +void free_orphan_vg (struct volume_group *vg);char *vg_fmt_dup (const struct volume_group *vg);char *vg_name_dup (const struct volume_group *vg);
tools/pvcreate.c +0 -1
@@ -117,7 +117,6 @@ ret =ECMD_FAILED ; } -free_pv_fid (pv);unlock_vg (cmd,VG_ORPHANS );if (sigint_caught ())return ret;
tools/vgconvert.c +0 -4
@@ -146,7 +146,6 @@ pv_dev_name(pv));log_error ("Use pvcreate and vgcfgrestore to repair " "from archived metadata." ); -free_pv_fid (pv);return ECMD_FAILED ; }
@@ -157,13 +156,10 @@ pv_dev_name(pv));log_error ("Use pvcreate and vgcfgrestore to repair " "from archived metadata." ); -free_pv_fid (pv);return ECMD_FAILED ; }log_verbose ("Physical volume \"%s\" successfully created" ,pv_dev_name (pv)); - -free_pv_fid (pv); }log_verbose ("Deleting existing metadata for VG %s" , vg_name);