public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW tools/pvresize.c
@ 2010-10-25 12:01 zkabelac
  0 siblings, 0 replies; 2+ messages in thread
From: zkabelac @ 2010-10-25 12:01 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2010-10-25 12:01:38

Modified files:
	.              : WHATS_NEW 
	tools          : pvresize.c 

Log message:
	Print vg_name and do not to access vg->name
	
	Reported by clang as: Logic error Dereference of null pointer
	Replace pointer dereference with vg_name.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1770&r2=1.1771
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvresize.c.diff?cvsroot=lvm2&r1=1.35&r2=1.36

--- LVM2/WHATS_NEW	2010/10/25 11:57:06	1.1770
+++ LVM2/WHATS_NEW	2010/10/25 12:01:38	1.1771
@@ -1,5 +1,6 @@
 Version 2.02.75 - 
 =====================================
+  Fix pointer for VG name in _pv_resize_single error code path.
   Fix warning for changed alignment requirements for dmeventd read/write func.
   Add global/metadata_read_only to use unrepaired metadata in read-only cmds.
   Don't take write lock in vgchange --refresh, --poll or --monitor.
--- LVM2/tools/pvresize.c	2010/05/19 01:16:41	1.35
+++ LVM2/tools/pvresize.c	2010/10/25 12:01:38	1.36
@@ -148,7 +148,7 @@
 	if (!is_orphan_vg(vg_name)) {
 		if (!vg_write(vg) || !vg_commit(vg)) {
 			log_error("Failed to store physical volume \"%s\" in "
-				  "volume group \"%s\"", pv_name, vg->name);
+				  "volume group \"%s\"", pv_name, vg_name);
 			goto out;
 		}
 		backup(vg);


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

* LVM2 ./WHATS_NEW tools/pvresize.c
@ 2008-09-12 15:26 mbroz
  0 siblings, 0 replies; 2+ messages in thread
From: mbroz @ 2008-09-12 15:26 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2008-09-12 15:26:45

Modified files:
	.              : WHATS_NEW 
	tools          : pvresize.c 

Log message:
	Fix pvresize to not allow resize if PV has two metadata areas.
	
	If the PV has two metadata areas, second one is located at the end of the device.
	
	Do not allow resize of PV or second metadata area can be overwritten.
	(The check was active only for orphan PVs.)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.950&r2=1.951
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvresize.c.diff?cvsroot=lvm2&r1=1.21&r2=1.22

--- LVM2/WHATS_NEW	2008/08/29 13:41:21	1.950
+++ LVM2/WHATS_NEW	2008/09/12 15:26:44	1.951
@@ -1,5 +1,6 @@
 Version 2.02.40 - 
 ================================
+  Fix pvresize to not allow resize if PV has two metadata areas.
   Fix setting of volume limit count if converting to lvm1 format.
   Fix vgconvert logical volume id metadata validation.
   Fix lvmdump metadata gather option (-m) to work correctly.
--- LVM2/tools/pvresize.c	2008/01/30 14:00:02	1.21
+++ LVM2/tools/pvresize.c	2008/09/12 15:26:45	1.22
@@ -35,6 +35,8 @@
 	struct list mdas;
 	const char *pv_name = pv_dev_name(pv);
 	const char *vg_name;
+	struct lvmcache_info *info;
+	int mda_count = 0;
 
 	list_init(&mdas);
 
@@ -51,13 +53,7 @@
 			return 0;
 		}
 
-		/* FIXME Create function to test compatibility properly */
-		if (list_size(&mdas) > 1) {
-			log_error("%s: too many metadata areas for pvresize",
-				  pv_name);
-			unlock_vg(cmd, vg_name);
-			return 0;
-		}
+		mda_count = list_size(&mdas);
 	} else {
 		vg_name = pv_vg_name(pv);
 
@@ -87,10 +83,26 @@
 
 		pv = pvl->pv;
 
+		if (!(info = info_from_pvid(pv->dev->pvid, 0))) {
+			unlock_vg(cmd, vg_name);
+			log_error("Can't get info for PV %s in volume group %s",
+				  pv_name, vg->name);
+			return 0;
+		}
+
+		mda_count = list_size(&info->mdas);
+
 		if (!archive(vg))
 			return 0;
 	}
 
+	/* FIXME Create function to test compatibility properly */
+	if (mda_count > 1) {
+		log_error("%s: too many metadata areas for pvresize", pv_name);
+		unlock_vg(cmd, vg_name);
+		return 0;
+	}
+
 	if (!(pv->fmt->features & FMT_RESIZE_PV)) {
 		log_error("Physical volume %s format does not support resizing.",
 			  pv_name);


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

end of thread, other threads:[~2010-10-25 12:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-25 12:01 LVM2 ./WHATS_NEW tools/pvresize.c zkabelac
  -- strict thread matches above, loose matches on Subject: below --
2008-09-12 15:26 mbroz

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).