public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW lib/cache/lvmcache.c lib/comm ...
@ 2011-10-11  9:09 zkabelac
  0 siblings, 0 replies; 6+ messages in thread
From: zkabelac @ 2011-10-11  9:09 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-10-11 09:09:01

Modified files:
	.              : WHATS_NEW 
	lib/cache      : lvmcache.c 
	lib/commands   : toolcontext.c 
	lib/metadata   : metadata.c 

Log message:
	Check for refresh_filter failure
	
	Properly detect if the filters were refreshed properly.
	
	(May needs few more fixes ??)
	
	Filter refresh may fail because it may be out of free file descriptors
	when clvmd gets overloaded.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2155&r2=1.2156
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.118&r2=1.119
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.137&r2=1.138
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.468&r2=1.469

--- LVM2/WHATS_NEW	2011/10/11 09:05:20	1.2155
+++ LVM2/WHATS_NEW	2011/10/11 09:09:00	1.2156
@@ -1,5 +1,6 @@
 Version 2.02.89 - 
 ==================================
+  Add check for access through NULL pointer when refresh_filter() fails.
   Use pthread condition for SINGLENODE lock implementation.
   Improve backtrace reporting for some dev_manager_ functions.
   Change message severity to log_warn when symlink creation fails.
--- LVM2/lib/cache/lvmcache.c	2011/09/01 10:25:22	1.118
+++ LVM2/lib/cache/lvmcache.c	2011/10/11 09:09:00	1.119
@@ -597,12 +597,10 @@
 		goto out;
 	}
 
-	if (full_scan == 2 && !cmd->filter->use_count && !refresh_filters(cmd)) {
-		log_error("refresh filters failed");
-		goto out;
-	}
+	if (full_scan == 2 && (cmd->filter && !cmd->filter->use_count) && !refresh_filters(cmd))
+		goto_out;
 
-	if (!(iter = dev_iter_create(cmd->filter, (full_scan == 2) ? 1 : 0))) {
+	if (!cmd->filter || !(iter = dev_iter_create(cmd->filter, (full_scan == 2) ? 1 : 0))) {
 		log_error("dev_iter creation failed");
 		goto out;
 	}
--- LVM2/lib/commands/toolcontext.c	2011/09/22 17:39:57	1.137
+++ LVM2/lib/commands/toolcontext.c	2011/10/11 09:09:00	1.138
@@ -786,7 +786,7 @@
 	cmd->dump_filter = 0;
 
 	if (!(f3 = _init_filter_components(cmd)))
-		return 0;
+		return_0;
 
 	init_ignore_suspended_devices(find_config_tree_int(cmd,
 	    "devices/ignore_suspended_devices", DEFAULT_IGNORE_SUSPENDED_DEVICES));
@@ -1402,7 +1402,8 @@
 		cmd->filter = NULL;
 	}
 
-	r = _init_filters(cmd, 0);
+	if (!(r = _init_filters(cmd, 0)))
+                stack;
 
 	/*
 	 * During repair code must not reset suspended flag.
--- LVM2/lib/metadata/metadata.c	2011/09/27 17:09:43	1.468
+++ LVM2/lib/metadata/metadata.c	2011/10/11 09:09:00	1.469
@@ -1373,7 +1373,9 @@
 	/* Is there an md superblock here? */
 	/* FIXME: still possible issues here - rescan cache? */
 	if (!dev && md_filtering()) {
-		refresh_filters(cmd);
+		if (!refresh_filters(cmd))
+			goto_bad;
+
 		init_md_filtering(0);
 		dev = dev_cache_get(name, cmd->filter);
 		init_md_filtering(1);


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

* LVM2 ./WHATS_NEW lib/cache/lvmcache.c lib/comm ...
@ 2010-05-13 13:04 mbroz
  0 siblings, 0 replies; 6+ messages in thread
From: mbroz @ 2010-05-13 13:04 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2010-05-13 13:04:06

Modified files:
	.              : WHATS_NEW 
	lib/cache      : lvmcache.c 
	lib/commands   : toolcontext.c 
	lib/filters    : filter-persistent.c filter-persistent.h 

Log message:
	Currently if clvmd is running and user issues vgscan,
	the device cache file is dumped both in vgscan and clvmd process.
	
	Unfortunately, clvmd calls lvmcache_label_scan,
	it properly destroys persistent filter, but during
	persistent_filter_dump it merges old cache content back!
	
	This causes that change in filters is not properly propagated
	into device cache after vgscan on cluster.
	(Only new devices are added.)
	
	https://bugzilla.redhat.com/show_bug.cgi?id=591861

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1555&r2=1.1556
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.85&r2=1.86
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.96&r2=1.97
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/filters/filter-persistent.c.diff?cvsroot=lvm2&r1=1.40&r2=1.41
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/filters/filter-persistent.h.diff?cvsroot=lvm2&r1=1.6&r2=1.7

--- LVM2/WHATS_NEW	2010/05/11 08:57:02	1.1555
+++ LVM2/WHATS_NEW	2010/05/13 13:04:03	1.1556
@@ -1,5 +1,6 @@
 Version 2.02.65 - 
 =================================
+  Do not merge old device cache after we run full scan. (2.02.56)
   Add pkgconfigdir Makefile variable for make install override.
   Switch usage of Libs.private: to Requires.private: in devmapper.pc, lvm2app.pc.
   Use field Requires.private: for devmapper-event.pc.
--- LVM2/lib/cache/lvmcache.c	2010/04/30 12:54:31	1.85
+++ LVM2/lib/cache/lvmcache.c	2010/05/13 13:04:05	1.86
@@ -567,7 +567,7 @@
 	 * device cache for the benefit of short-lived processes.
 	 */
 	if (full_scan == 2 && cmd->is_long_lived && cmd->dump_filter)
-		persistent_filter_dump(cmd->filter);
+		persistent_filter_dump(cmd->filter, 0);
 
 	r = 1;
 
--- LVM2/lib/commands/toolcontext.c	2010/05/05 22:37:52	1.96
+++ LVM2/lib/commands/toolcontext.c	2010/05/13 13:04:05	1.97
@@ -1341,7 +1341,7 @@
 void destroy_toolcontext(struct cmd_context *cmd)
 {
 	if (cmd->dump_filter)
-		persistent_filter_dump(cmd->filter);
+		persistent_filter_dump(cmd->filter, 1);
 
 	archive_exit(cmd);
 	backup_exit(cmd);
--- LVM2/lib/filters/filter-persistent.c	2010/01/06 13:25:36	1.40
+++ LVM2/lib/filters/filter-persistent.c	2010/05/13 13:04:05	1.41
@@ -168,7 +168,7 @@
 		fprintf(fp, "\n\t]\n");
 }
 
-int persistent_filter_dump(struct dev_filter *f)
+int persistent_filter_dump(struct dev_filter *f, int merge_existing)
 {
 	struct pfilter *pf;
 	char *tmp_file;
@@ -220,7 +220,7 @@
 	/*
 	 * If file contents changed since we loaded it, merge new contents
 	 */
-	if (info.st_ctime != pf->ctime)
+	if (merge_existing && info.st_ctime != pf->ctime)
 		/* Keep cft open to avoid losing lock */
 		persistent_filter_load(f, &cft);
 
--- LVM2/lib/filters/filter-persistent.h	2007/08/20 20:55:25	1.6
+++ LVM2/lib/filters/filter-persistent.h	2010/05/13 13:04:05	1.7
@@ -23,6 +23,6 @@
 
 int persistent_filter_wipe(struct dev_filter *f);
 int persistent_filter_load(struct dev_filter *f, struct config_tree **cft_out);
-int persistent_filter_dump(struct dev_filter *f);
+int persistent_filter_dump(struct dev_filter *f, int merge_existing);
 
 #endif


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

* LVM2 ./WHATS_NEW lib/cache/lvmcache.c lib/comm ...
@ 2010-04-01 10:34 agk
  0 siblings, 0 replies; 6+ messages in thread
From: agk @ 2010-04-01 10:34 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2010-04-01 10:34:11

Modified files:
	.              : WHATS_NEW 
	lib/cache      : lvmcache.c 
	lib/commands   : toolcontext.c 
	lib/config     : config.c 
	lib/device     : dev-io.c 
	lib/format1    : import-export.c 
	lib/format_text: import_vsn1.c 
	lib/locking    : locking.c 
	lib/metadata   : lv_manip.c 
	tools          : pvscan.c 

Log message:
	Change most remaining log_error WARNING messages to log_warn.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1498&r2=1.1499
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.83&r2=1.84
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.92&r2=1.93
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.77&r2=1.78
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-io.c.diff?cvsroot=lvm2&r1=1.65&r2=1.66
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/import-export.c.diff?cvsroot=lvm2&r1=1.110&r2=1.111
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.70&r2=1.71
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.76&r2=1.77
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.220&r2=1.221
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvscan.c.diff?cvsroot=lvm2&r1=1.49&r2=1.50

--- LVM2/WHATS_NEW	2010/03/31 17:23:56	1.1498
+++ LVM2/WHATS_NEW	2010/04/01 10:34:09	1.1499
@@ -1,5 +1,6 @@
 Version 2.02.63 -  
 ================================
+  Change most remaining log_error WARNING messages to log_warn.
   Always use blocking lock for VGs and orphan locks.
   Allocate all segments memory from vg private mempool.
   Return newly allocated PV segment after segment split.
--- LVM2/lib/cache/lvmcache.c	2010/03/31 17:20:44	1.83
+++ LVM2/lib/cache/lvmcache.c	2010/04/01 10:34:09	1.84
@@ -903,37 +903,37 @@
 		 */
 		if (!(primary_vginfo->status & EXPORTED_VG) &&
 		    (vgstatus & EXPORTED_VG))
-			log_error("WARNING: Duplicate VG name %s: "
-				  "Existing %s takes precedence over "
-				  "exported %s", new_vginfo->vgname,
-				  uuid_primary, uuid_new);
+			log_warn("WARNING: Duplicate VG name %s: "
+				 "Existing %s takes precedence over "
+				 "exported %s", new_vginfo->vgname,
+				 uuid_primary, uuid_new);
 		else if ((primary_vginfo->status & EXPORTED_VG) &&
 			   !(vgstatus & EXPORTED_VG)) {
-			log_error("WARNING: Duplicate VG name %s: "
-				  "%s takes precedence over exported %s",
-				  new_vginfo->vgname, uuid_new,
-				  uuid_primary);
+			log_warn("WARNING: Duplicate VG name %s: "
+				 "%s takes precedence over exported %s",
+				 new_vginfo->vgname, uuid_new,
+				 uuid_primary);
 			use_new = 1;
 		} else if (primary_vginfo->creation_host &&
 			   !strcmp(primary_vginfo->creation_host,
 				   primary_vginfo->fmt->cmd->hostname))
-			log_error("WARNING: Duplicate VG name %s: "
-				  "Existing %s (created here) takes precedence "
-				  "over %s", new_vginfo->vgname, uuid_primary,
-				  uuid_new);
+			log_warn("WARNING: Duplicate VG name %s: "
+				 "Existing %s (created here) takes precedence "
+				 "over %s", new_vginfo->vgname, uuid_primary,
+				 uuid_new);
 		else if (!primary_vginfo->creation_host && creation_host) {
-			log_error("WARNING: Duplicate VG name %s: "
-				  "%s (with creation_host) takes precedence over %s",
-				  new_vginfo->vgname, uuid_new,
-				  uuid_primary);
+			log_warn("WARNING: Duplicate VG name %s: "
+				 "%s (with creation_host) takes precedence over %s",
+				 new_vginfo->vgname, uuid_new,
+				 uuid_primary);
 			use_new = 1;
 		} else if (creation_host &&
 			   !strcmp(creation_host,
 				   primary_vginfo->fmt->cmd->hostname)) {
-			log_error("WARNING: Duplicate VG name %s: "
-				  "%s (created here) takes precedence over %s",
-				  new_vginfo->vgname, uuid_new,
-				  uuid_primary);
+			log_warn("WARNING: Duplicate VG name %s: "
+				 "%s (created here) takes precedence over %s",
+				 new_vginfo->vgname, uuid_new,
+				 uuid_primary);
 			use_new = 1;
 		}
 
--- LVM2/lib/commands/toolcontext.c	2010/03/09 03:16:11	1.92
+++ LVM2/lib/commands/toolcontext.c	2010/04/01 10:34:09	1.93
@@ -233,8 +233,8 @@
 	}
 
 	if (*cmd->proc_dir && !dir_exists(cmd->proc_dir)) {
-		log_error("WARNING: proc dir %s not found - some checks will be bypassed",
-			  cmd->proc_dir);
+		log_warn("WARNING: proc dir %s not found - some checks will be bypassed",
+			 cmd->proc_dir);
 		cmd->proc_dir[0] = '\0';
 	}
 
--- LVM2/lib/config/config.c	2009/10/22 10:38:07	1.77
+++ LVM2/lib/config/config.c	2010/04/01 10:34:09	1.78
@@ -911,9 +911,9 @@
 				if (!cn_found)
 					cn_found = cn;
 				else
-					log_error("WARNING: Ignoring duplicate"
-						  " config node: %s ("
-						  "seeking %s)", cn->key, path);
+					log_warn("WARNING: Ignoring duplicate"
+						 " config node: %s ("
+						 "seeking %s)", cn->key, path);
 			}
 
 			cn = cn->sib;
--- LVM2/lib/device/dev-io.c	2009/05/20 11:09:49	1.65
+++ LVM2/lib/device/dev-io.c	2010/04/01 10:34:10	1.66
@@ -383,8 +383,8 @@
 
 		if (dev->open_count && !need_excl) {
 			/* FIXME Ensure we never get here */
-			log_debug("WARNING: %s already opened read-only",
-				  dev_name(dev));
+			log_error(INTERNAL_ERROR "%s already opened read-only",
+				 dev_name(dev));
 			dev->open_count++;
 		}
 
@@ -392,8 +392,8 @@
 	}
 
 	if (memlock())
-		log_error("WARNING: dev_open(%s) called while suspended",
-			  dev_name(dev));
+		log_error(INTERNAL_ERROR "dev_open(%s) called while suspended",
+			 dev_name(dev));
 
 	if (dev->flags & DEV_REGULAR)
 		name = dev_name(dev);
--- LVM2/lib/format1/import-export.c	2009/09/28 17:46:16	1.110
+++ LVM2/lib/format1/import-export.c	2010/04/01 10:34:10	1.111
@@ -110,9 +110,9 @@
 			size = pv->pe_count * (uint64_t) vg->extent_size +
 			       pv->pe_start;
 			if (size > pv->size)
-				log_error("WARNING: Physical Volume %s is too "
-					  "large for underlying device",
-					  pv_dev_name(pv));
+				log_warn("WARNING: Physical Volume %s is too "
+					 "large for underlying device",
+					 pv_dev_name(pv));
 		}
 	}
 
--- LVM2/lib/format_text/import_vsn1.c	2010/03/31 17:20:03	1.70
+++ LVM2/lib/format_text/import_vsn1.c	2010/04/01 10:34:10	1.71
@@ -264,9 +264,9 @@
 			size = pv->pe_count * (uint64_t) vg->extent_size +
 			       pv->pe_start;
 			if (size > pv->size)
-				log_error("WARNING: Physical Volume %s is too "
-					  "large for underlying device",
-					  pv_dev_name(pv));
+				log_warn("WARNING: Physical Volume %s is too "
+					 "large for underlying device",
+					 pv_dev_name(pv));
 		}
 	}
 
--- LVM2/lib/locking/locking.c	2010/03/31 17:23:57	1.76
+++ LVM2/lib/locking/locking.c	2010/04/01 10:34:10	1.77
@@ -293,8 +293,7 @@
 	    find_config_tree_int(cmd, "locking/fallback_to_local_locking",
 	    	    find_config_tree_int(cmd, "global/fallback_to_local_locking",
 					 DEFAULT_FALLBACK_TO_LOCAL_LOCKING))) {
-		log_warn_suppress(suppress_messages,
-				  "WARNING: Falling back to local file-based locking.");
+		log_warn_suppress(suppress_messages, "WARNING: Falling back to local file-based locking.");
 		log_warn_suppress(suppress_messages,
 				  "Volume Groups with the clustered attribute will "
 				  "be inaccessible.");
--- LVM2/lib/metadata/lv_manip.c	2010/03/31 20:26:04	1.220
+++ LVM2/lib/metadata/lv_manip.c	2010/04/01 10:34:10	1.221
@@ -3172,7 +3172,7 @@
 	}
 
 	if (!lp->zero && !lp->snapshot)
-		log_error("WARNING: \"%s\" not zeroed", lv->name);
+		log_warn("WARNING: \"%s\" not zeroed", lv->name);
 	else if (!set_lv(cmd, lv, UINT64_C(0), 0)) {
 		log_error("Aborting. Failed to wipe %s.",
 			  lp->snapshot ? "snapshot exception store" :
--- LVM2/tools/pvscan.c	2009/12/11 13:16:39	1.49
+++ LVM2/tools/pvscan.c	2010/04/01 10:34:11	1.50
@@ -152,7 +152,7 @@
 		/* Also check for MD use? */
 /*******
 		if (MAJOR(pv_create_kdev_t(pv[p]->pv_name)) != MD_MAJOR) {
-			log_print
+			log_warn
 			    ("WARNING: physical volume \"%s\" belongs to a meta device",
 			     pv[p]->pv_name);
 		}


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

* LVM2 ./WHATS_NEW lib/cache/lvmcache.c lib/comm ...
@ 2009-11-24 16:11 mbroz
  0 siblings, 0 replies; 6+ messages in thread
From: mbroz @ 2009-11-24 16:11 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2009-11-24 16:11:38

Modified files:
	.              : WHATS_NEW 
	lib/cache      : lvmcache.c 
	lib/commands   : toolcontext.c 

Log message:
	Move persistent filter dump to more appropriate place.
	
	After context_refresh is cache empty, the cache flush
	does nothing.
	
	Call it after lvmcache full rescan if running from
	log lived process.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1324&r2=1.1325
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.72&r2=1.73
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.87&r2=1.88

--- LVM2/WHATS_NEW	2009/11/24 16:10:25	1.1324
+++ LVM2/WHATS_NEW	2009/11/24 16:11:37	1.1325
@@ -1,5 +1,6 @@
 Version 2.02.56 - 
 ====================================
+  Move persistent filter dump to more appropriate place.
   Refresh device filters before full device rescan in lvmcache.
   Return error status if vgchange fails to activate some volume.
   Fix memory lock imbalance in locking code.
--- LVM2/lib/cache/lvmcache.c	2009/11/24 16:10:25	1.72
+++ LVM2/lib/cache/lvmcache.c	2009/11/24 16:11:37	1.73
@@ -20,6 +20,7 @@
 #include "locking.h"
 #include "metadata.h"
 #include "filter.h"
+#include "filter-persistent.h"
 #include "memlock.h"
 #include "str_list.h"
 #include "format-text.h"
@@ -533,6 +534,13 @@
 			goto out;
 	}
 
+	/*
+	 * If we are a long-lived process, write out the updated persistent
+	 * device cache for the benefit of short-lived processes.
+	 */
+	if (full_scan == 2 && cmd->is_long_lived && cmd->dump_filter)
+		persistent_filter_dump(cmd->filter);
+
 	r = 1;
 
       out:
--- LVM2/lib/commands/toolcontext.c	2009/11/24 16:10:26	1.87
+++ LVM2/lib/commands/toolcontext.c	2009/11/24 16:11:38	1.88
@@ -1291,13 +1291,6 @@
 	if (!_init_segtypes(cmd))
 		return 0;
 
-	/*
-	 * If we are a long-lived process, write out the updated persistent
-	 * device cache for the benefit of short-lived processes.
-	 */
-	if (cmd->is_long_lived && cmd->dump_filter)
-		persistent_filter_dump(cmd->filter);
-
 	cmd->config_valid = 1;
 
 	reset_lvm_errno(1);


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

* LVM2 ./WHATS_NEW lib/cache/lvmcache.c lib/comm ...
@ 2009-11-24 16:10 mbroz
  0 siblings, 0 replies; 6+ messages in thread
From: mbroz @ 2009-11-24 16:10 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2009-11-24 16:10:26

Modified files:
	.              : WHATS_NEW 
	lib/cache      : lvmcache.c 
	lib/commands   : toolcontext.c toolcontext.h 

Log message:
	Refresh device filters before full device rescan in lvmcache.
	
	The sysfs filter initialise hash of available devices using
	scan of /sys/block. We need to refresh even this hash
	when performing full scan otherwise the newly appeared
	device could be rejected, because there is no entry
	in sysfs filter.
	
	This easily could happen when attaching new device
	to cluster node. (Only force refresh of context
	in clvmd -R works here now).
	
	Unfortunately consequences of this are much worse,
	missing device part on that node is replaced with missing segment
	(even when no partial arg is selected) and this directly
	lead to data corruption.
	
	See https://bugzilla.redhat.com/show_bug.cgi?id=538515
	
	Simply fix it by refreshing device filters in lvmcache
	before performing the full device scan.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1323&r2=1.1324
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.71&r2=1.72
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.86&r2=1.87
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.h.diff?cvsroot=lvm2&r1=1.35&r2=1.36

--- LVM2/WHATS_NEW	2009/11/24 16:08:49	1.1323
+++ LVM2/WHATS_NEW	2009/11/24 16:10:25	1.1324
@@ -1,5 +1,6 @@
 Version 2.02.56 - 
 ====================================
+  Refresh device filters before full device rescan in lvmcache.
   Return error status if vgchange fails to activate some volume.
   Fix memory lock imbalance in locking code.
   Revert vg_read_internal change, clvmd cannot use vg_read now. (2.02.55)
--- LVM2/lib/cache/lvmcache.c	2009/10/27 17:00:46	1.71
+++ LVM2/lib/cache/lvmcache.c	2009/11/24 16:10:25	1.72
@@ -510,6 +510,11 @@
 		goto out;
 	}
 
+	if (full_scan == 2 && !refresh_filters(cmd)) {
+		log_error("refresh filters failed");
+		goto out;
+	}
+
 	if (!(iter = dev_iter_create(cmd->filter, (full_scan == 2) ? 1 : 0))) {
 		log_error("dev_iter creation failed");
 		goto out;
--- LVM2/lib/commands/toolcontext.c	2009/10/16 17:41:50	1.86
+++ LVM2/lib/commands/toolcontext.c	2009/11/24 16:10:26	1.87
@@ -1223,6 +1223,16 @@
 	}
 }
 
+int refresh_filters(struct cmd_context *cmd)
+{
+	if (cmd->filter) {
+		cmd->filter->destroy(cmd->filter);
+		cmd->filter = NULL;
+	}
+
+	return _init_filters(cmd, 0);
+}
+
 int refresh_toolcontext(struct cmd_context *cmd)
 {
 	log_verbose("Reloading config files");
--- LVM2/lib/commands/toolcontext.h	2009/10/16 17:41:50	1.35
+++ LVM2/lib/commands/toolcontext.h	2009/11/24 16:10:26	1.36
@@ -105,6 +105,7 @@
 				       const char *system_dir);
 void destroy_toolcontext(struct cmd_context *cmd);
 int refresh_toolcontext(struct cmd_context *cmd);
+int refresh_filters(struct cmd_context *cmd);
 int config_files_changed(struct cmd_context *cmd);
 int init_lvmcache_orphans(struct cmd_context *cmd);
 


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

* LVM2 ./WHATS_NEW lib/cache/lvmcache.c lib/comm ...
@ 2008-04-02 21:23 agk
  0 siblings, 0 replies; 6+ messages in thread
From: agk @ 2008-04-02 21:23 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2008-04-02 21:23:39

Modified files:
	.              : WHATS_NEW 
	lib/cache      : lvmcache.c 
	lib/commands   : toolcontext.h 
	tools          : commands.h lvmcmdline.c tools.h 

Log message:
	Add per-command flags to control which commands use the VG metadata cache.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.817&r2=1.818
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/cache/lvmcache.c.diff?cvsroot=lvm2&r1=1.40&r2=1.41
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.h.diff?cvsroot=lvm2&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/commands.h.diff?cvsroot=lvm2&r1=1.108&r2=1.109
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.61&r2=1.62
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/tools.h.diff?cvsroot=lvm2&r1=1.60&r2=1.61

--- LVM2/WHATS_NEW	2008/04/02 19:30:12	1.817
+++ LVM2/WHATS_NEW	2008/04/02 21:23:38	1.818
@@ -1,5 +1,6 @@
 Version 2.02.34 -
 ===================================
+  Add per-command flags to control which commands use the VG metadata cache.
   Fix vgsplit locking, remove unneeded error messages when split into new VG.
   Suppress duplicate message when lvresize fails because of invalid vgname.
   Cache VG metadata internally while VG lock is held.
--- LVM2/lib/cache/lvmcache.c	2008/04/01 22:40:12	1.40
+++ LVM2/lib/cache/lvmcache.c	2008/04/02 21:23:39	1.41
@@ -868,7 +868,8 @@
 	}
 
 	/* store text representation of vg to cache */
-	if ((vginfo = vginfo_from_vgname(vg->name, NULL)))
+	if (vg->cmd->current_settings.cache_vgmetadata &&
+	    (vginfo = vginfo_from_vgname(vg->name, NULL)))
 		_store_metadata(vginfo, vg, precommitted);
 
 	return 1;
--- LVM2/lib/commands/toolcontext.h	2007/11/09 16:51:53	1.21
+++ LVM2/lib/commands/toolcontext.h	2008/04/02 21:23:39	1.22
@@ -34,6 +34,7 @@
 	int archive;		/* should we archive ? */
 	int backup;		/* should we backup ? */
 	int read_ahead;		/* DM_READ_AHEAD_NONE or _AUTO */
+	int cache_vgmetadata;
 	const char *msg_prefix;
 	struct format_type *fmt;
 	uint64_t unit_factor;
--- LVM2/tools/commands.h	2008/01/22 02:48:53	1.108
+++ LVM2/tools/commands.h	2008/04/02 21:23:39	1.109
@@ -30,6 +30,7 @@
 
 xx(dumpconfig,
    "Dump active configuration",
+   0,
    "dumpconfig "
    "\t[-f|--file filename] " "\n"
    "[ConfigurationVariable...]\n",
@@ -37,10 +38,12 @@
 
 xx(formats,
    "List available metadata formats",
+   0,
    "formats\n")
 
 xx(help,
    "Display help for commands",
+   0,
    "help <command>" "\n")
 
 /*********
@@ -55,6 +58,7 @@
 
 xx(lvchange,
    "Change the attributes of logical volume(s)",
+   CACHE_VGMETADATA,
    "lvchange\n"
    "\t[-A|--autobackup y|n]\n"
    "\t[-a|--available [e|l]y|n]\n"
@@ -87,6 +91,7 @@
 
 xx(lvconvert,
    "Change logical volume layout",
+   0,
    "lvconvert "
    "[-m|--mirrors Mirrors [{--mirrorlog {disk|core}|--corelog}]]\n"
    "\t[-R|--regionsize MirrorLogRegionSize]\n"
@@ -114,6 +119,7 @@
 
 xx(lvcreate,
    "Create a logical volume",
+   0,
    "lvcreate " "\n"
    "\t[-A|--autobackup {y|n}]\n"
    "\t[--addtag Tag]\n"
@@ -165,6 +171,7 @@
 
 xx(lvdisplay,
    "Display information about a logical volume",
+   0,
    "lvdisplay\n"
    "\t[-a|--all]\n"
    "\t[-c|--colon]\n"
@@ -205,6 +212,7 @@
 
 xx(lvextend,
    "Add space to a logical volume",
+   0,
    "lvextend\n"
    "\t[-A|--autobackup y|n]\n"
    "\t[--alloc AllocationPolicy]\n"
@@ -228,6 +236,7 @@
 
 xx(lvmchange,
    "With the device mapper, this is obsolete and does nothing.",
+   0,
    "lvmchange\n"
    "\t[-d|--debug]\n"
    "\t[-h|--help]\n"
@@ -239,6 +248,7 @@
 
 xx(lvmdiskscan,
    "List devices that may be used as physical volumes",
+   0,
    "lvmdiskscan\n"
    "\t[-d|--debug]\n"
    "\t[-h|--help]\n"
@@ -249,6 +259,7 @@
 
 xx(lvmsadc,
    "Collect activity data",
+   0,
    "lvmsadc\n"
    "\t[-d|--debug]\n"
    "\t[-h|--help]\n"
@@ -258,6 +269,7 @@
 
 xx(lvmsar,
    "Create activity report",
+   0,
    "lvmsar\n"
    "\t[-d|--debug]\n"
    "\t[-f|--full]\n"
@@ -271,6 +283,7 @@
 
 xx(lvreduce,
    "Reduce the size of a logical volume",
+   0,
    "lvreduce\n"
    "\t[-A|--autobackup y|n]\n"
    "\t[-d|--debug]\n"
@@ -291,6 +304,7 @@
 
 xx(lvremove,
    "Remove logical volume(s) from the system",
+   0,
    "lvremove\n"
    "\t[-A|--autobackup y|n]\n"
    "\t[-d|--debug]\n"
@@ -305,6 +319,7 @@
 
 xx(lvrename,
    "Rename a logical volume",
+   0,
    "lvrename "
    "\t[-A|--autobackup {y|n}] " "\n"
    "\t[-d|--debug] " "\n"
@@ -319,6 +334,7 @@
 
 xx(lvresize,
    "Resize a logical volume",
+   0,
    "lvresize\n"
    "\t[-A|--autobackup y|n]\n"
    "\t[--alloc AllocationPolicy]\n"
@@ -340,6 +356,7 @@
 
 xx(lvs,
    "Display information about logical volumes",
+   0,
    "lvs" "\n"
    "\t[-a|--all]\n"
    "\t[--aligned]\n"
@@ -366,6 +383,7 @@
 
 xx(lvscan,
    "List all logical volumes in all volume groups",
+   0,
    "lvscan " "\n"
    "\t[-a|--all]\n"
    "\t[-b|--blockdevice] " "\n"
@@ -380,6 +398,7 @@
 
 xx(pvchange,
    "Change attributes of physical volume(s)",
+   0,
    "pvchange\n"
    "\t[-a|--all]\n"
    "\t[-A|--autobackup y|n]\n"
@@ -399,6 +418,7 @@
 
 xx(pvresize,
    "Resize physical volume(s)",
+   0,
    "pvresize " "\n"
    "\t[-d|--debug]" "\n"
    "\t[-h|-?|--help] " "\n"
@@ -412,6 +432,7 @@
 
 xx(pvck,
    "Check the consistency of physical volume(s)",
+   0,
    "pvck "
    "\t[-d|--debug]\n"
    "\t[-h|--help]\n"
@@ -424,6 +445,7 @@
 
 xx(pvcreate,
    "Initialize physical volume(s) for use by LVM",
+   0,
    "pvcreate " "\n"
    "\t[--restorefile file]\n"
    "\t[-d|--debug]" "\n"
@@ -448,6 +470,7 @@
 
 xx(pvdata,
    "Display the on-disk metadata for physical volume(s)",
+   0,
    "pvdata " "\n"
    "\t[-a|--all] " "\n"
    "\t[-d|--debug] " "\n"
@@ -466,6 +489,7 @@
 
 xx(pvdisplay,
    "Display various attributes of physical volume(s)",
+   0,
    "pvdisplay\n"
    "\t[-c|--colon]\n"
    "\t[-d|--debug]\n"
@@ -502,6 +526,7 @@
 
 xx(pvmove,
    "Move extents from one physical volume to another",
+   0,
    "pvmove " "\n"
    "\t[--abort]\n"
    "\t[-A|--autobackup {y|n}]\n"
@@ -523,6 +548,7 @@
 
 xx(pvremove,
    "Remove LVM label(s) from physical volume(s)",
+   0,
    "pvremove " "\n"
    "\t[-d|--debug]" "\n"
    "\t[-f[f]|--force [--force]] " "\n"
@@ -537,6 +563,7 @@
 
 xx(pvs,
    "Display information about physical volumes",
+   0,
    "pvs" "\n"
    "\t[--aligned]\n"
    "\t[-a|--all]\n"
@@ -563,6 +590,7 @@
 
 xx(pvscan,
    "List all physical volumes",
+   0,
    "pvscan " "\n"
    "\t[-d|--debug] " "\n"
    "\t{-e|--exported | -n|--novolumegroup} " "\n"
@@ -579,10 +607,12 @@
 
 xx(segtypes,
    "List available segment types",
+   0,
    "segtypes\n")
 
 xx(vgcfgbackup,
    "Backup volume group configuration(s)",
+   0,
    "vgcfgbackup " "\n"
    "\t[-d|--debug] " "\n"
    "\t[-f|--file filename] " "\n"
@@ -597,6 +627,7 @@
 
 xx(vgcfgrestore,
    "Restore volume group configuration",
+   0,
    "vgcfgrestore " "\n"
    "\t[-d|--debug] " "\n"
    "\t[-f|--file filename] " "\n"
@@ -613,6 +644,7 @@
 
 xx(vgchange,
    "Change volume group attributes",
+   CACHE_VGMETADATA,
    "vgchange" "\n"
    "\t[-A|--autobackup {y|n}] " "\n"
    "\t[--alloc AllocationPolicy] " "\n"
@@ -643,6 +675,7 @@
 
 xx(vgck,
    "Check the consistency of volume group(s)",
+   0,
    "vgck "
    "\t[-d|--debug]\n"
    "\t[-h|--help]\n"
@@ -652,6 +685,7 @@
 
 xx(vgconvert,
    "Change volume group metadata format",
+   0,
    "vgconvert  " "\n"
    "\t[-d|--debug]" "\n"
    "\t[-h|--help] " "\n"
@@ -669,6 +703,7 @@
 
 xx(vgcreate,
    "Create a volume group",
+   0,
    "vgcreate" "\n"
    "\t[-A|--autobackup {y|n}] " "\n"
    "\t[--addtag Tag] " "\n"
@@ -690,6 +725,7 @@
 
 xx(vgdisplay,
    "Display volume group information",
+   0,
    "vgdisplay " "\n"
    "\t[-c|--colon | -s|--short | -v|--verbose]" "\n"
    "\t[-d|--debug] " "\n"
@@ -725,6 +761,7 @@
 
 xx(vgexport,
    "Unregister volume group(s) from the system",
+   0,
    "vgexport " "\n"
    "\t[-a|--all] " "\n"
    "\t[-d|--debug] " "\n"
@@ -737,6 +774,7 @@
 
 xx(vgextend,
    "Add physical volumes to a volume group",
+   0,
    "vgextend\n"
    "\t[-A|--autobackup y|n]\n"
    "\t[-d|--debug]\n"
@@ -750,6 +788,7 @@
 
 xx(vgimport,
    "Register exported volume group with system",
+   0,
    "vgimport " "\n"
    "\t[-a|--all]\n"
    "\t[-d|--debug] " "\n"
@@ -764,6 +803,7 @@
 
 xx(vgmerge,
    "Merge volume groups",
+   0,
    "vgmerge\n"
    "\t[-A|--autobackup y|n]\n"
    "\t[-d|--debug]\n"
@@ -778,6 +818,7 @@
 
 xx(vgmknodes,
    "Create the special files for volume group devices in /dev",
+   0,
    "vgmknodes\n"
    "\t[-d|--debug]\n"
    "\t[-h|--help]\n"
@@ -790,6 +831,7 @@
 
 xx(vgreduce,
    "Remove physical volume(s) from a volume group",
+   0,
    "vgreduce\n"
    "\t[-a|--all]\n"
    "\t[-A|--autobackup y|n]\n"
@@ -807,6 +849,7 @@
 
 xx(vgremove,
    "Remove volume group(s)",
+   0,
    "vgremove\n"
    "\t[-d|--debug]\n"
    "\t[-f|--force]\n"
@@ -820,6 +863,7 @@
 
 xx(vgrename,
    "Rename a volume group",
+   0,
    "vgrename\n"
    "\t[-A|--autobackup y|n]\n"
    "\t[-d|--debug]\n"
@@ -834,6 +878,7 @@
 
 xx(vgs,
    "Display information about volume groups",
+   0,
    "vgs" "\n"
    "\t[--aligned]\n"
    "\t[-a|--all]\n"
@@ -859,6 +904,7 @@
 
 xx(vgscan,
    "Search for all volume groups",
+   0,
    "vgscan "
    "\t[-d|--debug]\n"
    "\t[-h|--help]\n"
@@ -872,6 +918,7 @@
 
 xx(vgsplit,
    "Move physical volumes into a new or existing volume group",
+   0,
    "vgsplit " "\n"
    "\t[-A|--autobackup {y|n}] " "\n"
    "\t[--alloc AllocationPolicy] " "\n"
@@ -893,5 +940,6 @@
 
 xx(version,
    "Display software and driver version information",
+   0,
    "version\n" )
 
--- LVM2/tools/lvmcmdline.c	2008/01/30 14:00:02	1.61
+++ LVM2/tools/lvmcmdline.c	2008/04/02 21:23:39	1.62
@@ -421,6 +421,7 @@
 }
 
 static void _create_new_command(const char *name, command_fn command,
+				unsigned flags,
 				const char *desc, const char *usagestr,
 				int nargs, int *args)
 {
@@ -434,12 +435,13 @@
 	nc->desc = desc;
 	nc->usage = usagestr;
 	nc->fn = command;
+	nc->flags = flags;
 	nc->num_args = nargs;
 	nc->valid_args = args;
 }
 
-static void _register_command(const char *name, command_fn fn,
-			      const char *desc, const char *usagestr, ...)
+static void _register_command(const char *name, command_fn fn, const char *desc,
+			      unsigned flags, const char *usagestr, ...)
 {
 	int nargs = 0, i;
 	int *args;
@@ -464,16 +466,16 @@
 	va_end(ap);
 
 	/* enter the command in the register */
-	_create_new_command(name, fn, desc, usagestr, nargs, args);
+	_create_new_command(name, fn, flags, desc, usagestr, nargs, args);
 }
 
 void lvm_register_commands(void)
 {
-#define xx(a, b, c...) _register_command(# a, a, b, ## c, \
-					driverloaded_ARG, \
-					debug_ARG, help_ARG, help2_ARG, \
-					version_ARG, verbose_ARG, \
-					quiet_ARG, config_ARG, -1);
+#define xx(a, b, c, d...) _register_command(# a, a, b, c, ## d, \
+					    driverloaded_ARG, \
+					    debug_ARG, help_ARG, help2_ARG, \
+					    version_ARG, verbose_ARG, \
+					    quiet_ARG, config_ARG, -1);
 #include "commands.h"
 #undef xx
 }
@@ -707,6 +709,7 @@
 
 	cmd->current_settings.archive = arg_int_value(cmd, autobackup_ARG, cmd->current_settings.archive);
 	cmd->current_settings.backup = arg_int_value(cmd, autobackup_ARG, cmd->current_settings.backup);
+	cmd->current_settings.cache_vgmetadata = cmd->command->flags & CACHE_VGMETADATA ? 1 : 0;
 
 	if (arg_count(cmd, partial_ARG)) {
 		init_partial(1);
--- LVM2/tools/tools.h	2008/01/10 18:35:51	1.60
+++ LVM2/tools/tools.h	2008/04/02 21:23:39	1.61
@@ -117,6 +117,8 @@
 	void *ptr;
 };
 
+#define CACHE_VGMETADATA 0x00000001
+
 /* a register of the lvm commands */
 struct command {
 	const char *name;
@@ -124,6 +126,8 @@
 	const char *usage;
 	command_fn fn;
 
+	unsigned flags;
+
 	int num_args;
 	int *valid_args;
 };


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

end of thread, other threads:[~2011-10-11  9:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-11  9:09 LVM2 ./WHATS_NEW lib/cache/lvmcache.c lib/comm zkabelac
  -- strict thread matches above, loose matches on Subject: below --
2010-05-13 13:04 mbroz
2010-04-01 10:34 agk
2009-11-24 16:11 mbroz
2009-11-24 16:10 mbroz
2008-04-02 21:23 agk

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