public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/liblvm lvm_vg.c
@ 2009-07-26 20:29 wysochanski
  0 siblings, 0 replies; 4+ messages in thread
From: wysochanski @ 2009-07-26 20:29 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2009-07-26 20:29:28

Modified files:
	liblvm         : lvm_vg.c 

Log message:
	Update a few liblvm calls with log_errno.
	
	Author: Dave Wysochanski <dwysocha@redhat.com>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_vg.c.diff?cvsroot=lvm2&r1=1.16&r2=1.17

--- LVM2/liblvm/lvm_vg.c	2009/07/26 20:28:59	1.16
+++ LVM2/liblvm/lvm_vg.c	2009/07/26 20:29:28	1.17
@@ -144,14 +144,15 @@
 		return NULL;
 
 	if (!(list = dm_pool_zalloc(vg->vgmem, sizeof(*list)))) {
-		log_error("Memory allocation fail for dm_list.\n");
+		log_errno(ENOMEM, "Memory allocation fail for dm_list.\n");
 		return NULL;
 	}
 	dm_list_init(list);
 
 	dm_list_iterate_items(pvl, &vg->pvs) {
 		if (!(pvs = dm_pool_zalloc(vg->vgmem, sizeof(*pvs)))) {
-			log_error("Memory allocation fail for lvm_pv_list.\n");
+			log_errno(ENOMEM,
+				"Memory allocation fail for lvm_pv_list.\n");
 			return NULL;
 		}
 		pvs->pv = pvl->pv;
@@ -170,14 +171,15 @@
 		return NULL;
 
 	if (!(list = dm_pool_zalloc(vg->vgmem, sizeof(*list)))) {
-		log_error("Memory allocation fail for dm_list.\n");
+		log_errno(ENOMEM, "Memory allocation fail for dm_list.\n");
 		return NULL;
 	}
 	dm_list_init(list);
 
 	dm_list_iterate_items(lvl, &vg->lvs) {
 		if (!(lvs = dm_pool_zalloc(vg->vgmem, sizeof(*lvs)))) {
-			log_error("Memory allocation fail for lvm_lv_list.\n");
+			log_errno(ENOMEM,
+				"Memory allocation fail for lvm_lv_list.\n");
 			return NULL;
 		}
 		lvs->lv = lvl->lv;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* LVM2/liblvm lvm_vg.c
@ 2011-04-01 13:44 prajnoha
  0 siblings, 0 replies; 4+ messages in thread
From: prajnoha @ 2011-04-01 13:44 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	prajnoha@sourceware.org	2011-04-01 13:44:51

Modified files:
	liblvm         : lvm_vg.c 

Log message:
	Finalize PV format instances properly in lvm_vg_write fn.
	
	lvm_vg_write fn reinitializes the vg->removed_pvs list. We have to finalize
	all PV format instances attached to PVs found in the original list.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_vg.c.diff?cvsroot=lvm2&r1=1.51&r2=1.52

--- LVM2/liblvm/lvm_vg.c	2011/02/18 14:47:30	1.51
+++ LVM2/liblvm/lvm_vg.c	2011/04/01 13:44:51	1.52
@@ -147,6 +147,7 @@
 	if (! dm_list_empty(&vg->removed_pvs)) {
 		dm_list_iterate_items(pvl, &vg->removed_pvs) {
 			pv_write_orphan(vg->cmd, pvl->pv);
+			pv_set_fid(pvl->pv, NULL);
 			/* FIXME: do pvremove / label_remove()? */
 		}
 		dm_list_init(&vg->removed_pvs);


^ permalink raw reply	[flat|nested] 4+ messages in thread

* LVM2/liblvm lvm_vg.c
@ 2009-07-24 15:12 wysochanski
  0 siblings, 0 replies; 4+ messages in thread
From: wysochanski @ 2009-07-24 15:12 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2009-07-24 15:12:50

Modified files:
	liblvm         : lvm_vg.c 

Log message:
	Update lvm_vg_extend() to obtain VG_ORPHAN.
	
	vg_extend() no longer obtains VG_OPHAN so we must do so in liblvm function.
	We still have the race in liblvm but we will address this problem later.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_vg.c.diff?cvsroot=lvm2&r1=1.8&r2=1.9

--- LVM2/liblvm/lvm_vg.c	2009/07/24 12:48:21	1.8
+++ LVM2/liblvm/lvm_vg.c	2009/07/24 15:12:50	1.9
@@ -40,11 +40,23 @@
 int lvm_vg_extend(vg_t *vg, const char *device)
 {
 	if (vg_read_error(vg))
-		goto_bad;
+		return 0;
 
-	return vg_extend(vg, 1, (char **) &device);
-bad:
-	return 0;
+	if (!lock_vol(vg->cmd, VG_ORPHANS, LCK_VG_WRITE)) {
+		log_error("Can't get lock for orphan PVs");
+		return 0;
+	}
+
+	if (!vg_extend(vg, 1, (char **) &device)) {
+		unlock_vg(vg->cmd, VG_ORPHANS);
+		return 0;
+	}
+	/*
+	 * FIXME: Either commit to disk, or keep holding VG_ORPHANS and
+	 * release in lvm_vg_close().
+	 */
+	unlock_vg(vg->cmd, VG_ORPHANS);
+	return 1;
 }
 
 int lvm_vg_set_extent_size(vg_t *vg, uint32_t new_size)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* LVM2/liblvm lvm_vg.c
@ 2009-07-22  3:13 wysochanski
  0 siblings, 0 replies; 4+ messages in thread
From: wysochanski @ 2009-07-22  3:13 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2009-07-22 03:13:36

Modified files:
	liblvm         : lvm_vg.c 

Log message:
	Fix lvm_vg_close() when locking fails.
	
	Author: Dave Wysochanski <dwysocha@redhat.com>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/liblvm/lvm_vg.c.diff?cvsroot=lvm2&r1=1.1&r2=1.2

--- LVM2/liblvm/lvm_vg.c	2009/07/14 03:02:14	1.1
+++ LVM2/liblvm/lvm_vg.c	2009/07/22 03:13:35	1.2
@@ -64,13 +64,11 @@
 
 int lvm_vg_close(vg_t *vg)
 {
-	if (vg_read_error(vg))
-		goto_bad;
-
-	unlock_and_release_vg(vg->cmd, vg, vg->name);
+	if (vg_read_error(vg) == FAILED_LOCKING)
+		vg_release(vg);
+	else
+		unlock_and_release_vg(vg->cmd, vg, vg->name);
 	return 1;
-bad:
-	return 0;
 }
 
 int lvm_vg_remove(vg_t *vg)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-04-01 13:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-26 20:29 LVM2/liblvm lvm_vg.c wysochanski
  -- strict thread matches above, loose matches on Subject: below --
2011-04-01 13:44 prajnoha
2009-07-24 15:12 wysochanski
2009-07-22  3:13 wysochanski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).