public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW lib/locking/locking.c
@ 2011-08-10 16:07 mbroz
  0 siblings, 0 replies; 10+ messages in thread
From: mbroz @ 2011-08-10 16:07 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2011-08-10 16:07:54

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

Log message:
	If anything bad happens and unlocking fails
	(here clvmd crashed in the middle of operation),
	lock is not removed from cache - here is one example:
	
	locking/cluster_locking.c:497       Locking VG V_vg_test UN (VG) (0x6)
	locking/cluster_locking.c:113   Error writing data to clvmd: Broken pipe
	locking/locking.c:399         <backtrace>
	locking/locking.c:461         <backtrace>
	Internal error: Volume Group vg_test was not unlocked
	
	Code should always remove lock info from lvmcache and update counters
	on unlock, even if unlock fails.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2055&r2=1.2056
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.96&r2=1.97

--- LVM2/WHATS_NEW	2011/08/10 11:00:32	1.2055
+++ LVM2/WHATS_NEW	2011/08/10 16:07:53	1.2056
@@ -1,5 +1,6 @@
 Version 2.02.87 - 
 ===============================
+  Remove lock from cache even if unlock fails.
   Initialise clvmd locks before lvm context to avoid open descriptor leaks.
   Remove obsoleted GULM clvmd cluster locking support.
   Suppress low-level locking errors and warnings while using --sysinit.
--- LVM2/lib/locking/locking.c	2011/08/09 11:44:57	1.96
+++ LVM2/lib/locking/locking.c	2011/08/10 16:07:54	1.97
@@ -359,6 +359,8 @@
 static int _lock_vol(struct cmd_context *cmd, const char *resource,
 		     uint32_t flags, lv_operation_t lv_op)
 {
+	uint32_t lck_type = flags & LCK_TYPE_MASK;
+	uint32_t lck_scope = flags & LCK_SCOPE_MASK;
 	int ret = 0;
 
 	_block_signals(flags);
@@ -376,21 +378,16 @@
 		return 0;
 	}
 
-	if (cmd->metadata_read_only &&
-	    ((flags & LCK_TYPE_MASK) == LCK_WRITE) &&
+	if (cmd->metadata_read_only && lck_type == LCK_WRITE &&
 	    strcmp(resource, VG_GLOBAL)) {
 		log_error("Operation prohibited while global/metadata_read_only is set.");
 		return 0;
 	}
 
 	if ((ret = _locking.lock_resource(cmd, resource, flags))) {
-		if ((flags & LCK_SCOPE_MASK) == LCK_VG &&
-		    !(flags & LCK_CACHE)) {
-			if ((flags & LCK_TYPE_MASK) == LCK_UNLOCK)
-				lvmcache_unlock_vgname(resource);
-			else
-				lvmcache_lock_vgname(resource, (flags & LCK_TYPE_MASK)
-								== LCK_READ);
+		if (lck_scope == LCK_VG && !(flags & LCK_CACHE)) {
+			if (lck_type != LCK_UNLOCK)
+				lvmcache_lock_vgname(resource, lck_type == LCK_READ);
 			dev_reset_error_count(cmd);
 		}
 
@@ -398,6 +395,13 @@
 	} else
 		stack;
 
+	/* If unlocking, always remove lock from lvmcache even if operation failed. */
+	if (lck_scope == LCK_VG && !(flags & LCK_CACHE) && lck_type == LCK_UNLOCK) {
+		lvmcache_unlock_vgname(resource);
+		if (!ret)
+			_update_vg_lock_count(resource, flags);
+	}
+
 	_unlock_memory(cmd, lv_op);
 	_unblock_signals();
 


^ permalink raw reply	[flat|nested] 10+ messages in thread
* LVM2 ./WHATS_NEW lib/locking/locking.c
@ 2012-03-27 15:53 mbroz
  0 siblings, 0 replies; 10+ messages in thread
From: mbroz @ 2012-03-27 15:53 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2012-03-27 15:53:45

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

Log message:
	Fix exclusive lvmchange -aey to fail if volume is active on different node.
	
	Activation on remote node should be tried only if it is masked by tags
	locally (like when hosttags enabled, IOW activate_lv_excl_local()
	doesn't return error.)
	
	Introduced change caused that lvchange -aey succeeded even if volume was
	activated exclusively remotely.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2371&r2=1.2372
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.104&r2=1.105

--- LVM2/WHATS_NEW	2012/03/27 11:04:46	1.2371
+++ LVM2/WHATS_NEW	2012/03/27 15:53:45	1.2372
@@ -1,5 +1,6 @@
 Version 2.02.96 - 
 ================================
+  Fix exclusive lvchange running from other node. (2.02.89)
   Add 'vgscan --cache' functionality for consistency with 'pvscan --cache'.
   Keep exclusive activation in pvmove if LV is already active.
   Disallow pvmove for exclusive LV if some affected LVs are not exclusively activated.
--- LVM2/lib/locking/locking.c	2012/03/26 20:33:40	1.104
+++ LVM2/lib/locking/locking.c	2012/03/27 15:53:45	1.105
@@ -551,7 +551,7 @@
 	if (!vg_is_clustered(lv->vg))
 		return activate_lv_excl_local(cmd, lv);
 
-	if (lv_is_active_exclusive(lv))
+	if (lv_is_active_exclusive_locally(lv))
 		return 1;
 
 	if (!activate_lv_excl_local(cmd, lv))


^ permalink raw reply	[flat|nested] 10+ messages in thread
* LVM2 ./WHATS_NEW lib/locking/locking.c
@ 2011-01-13 14:56 zkabelac
  0 siblings, 0 replies; 10+ messages in thread
From: zkabelac @ 2011-01-13 14:56 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-01-13 14:56:17

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

Log message:
	Skip unnecessary lock_vol() call after volume deactivation
	
	Improve condition within lock_vol so we are not calling extra unlock
	if the volume just has been deactivated.
	
	Patch uses lck_type and replaces negative 'and' condition to more
	readable 'or' condition.
	Few missing strace traces added.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1879&r2=1.1880
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.88&r2=1.89

--- LVM2/WHATS_NEW	2011/01/13 14:51:32	1.1879
+++ LVM2/WHATS_NEW	2011/01/13 14:56:17	1.1880
@@ -1,5 +1,6 @@
 Version 2.02.81 -
 ===================================
+  Skip unnecessary lock_vol() call after volume deactivation.
   Extend exec_cmd params to specify, when device sync is needed.
   Replace fs_unlock by sync_local_dev_names to notify local clvmd. (2.02.80)
   Introduce sync_local_dev_names and CLVMD_CMD_SYNC_NAMES to issue fs_unlock.
--- LVM2/lib/locking/locking.c	2011/01/12 20:42:50	1.88
+++ LVM2/lib/locking/locking.c	2011/01/13 14:56:17	1.89
@@ -406,6 +406,7 @@
 {
 	char resource[258] __attribute__((aligned(8)));
 	lv_operation_t lv_op;
+	int lck_type = flags & LCK_TYPE_MASK;
 
 	switch (flags & (LCK_SCOPE_MASK | LCK_TYPE_MASK)) {
 		case LCK_LV_SUSPEND:
@@ -432,15 +433,15 @@
 		if (is_orphan_vg(vol))
 			vol = VG_ORPHANS;
 		/* VG locks alphabetical, ORPHAN lock last */
-		if (((flags & LCK_TYPE_MASK) != LCK_UNLOCK) &&
-			 !(flags & LCK_CACHE) &&
-			 !lvmcache_verify_lock_order(vol))
-			return 0;
+		if ((lck_type != LCK_UNLOCK) &&
+		    !(flags & LCK_CACHE) &&
+		    !lvmcache_verify_lock_order(vol))
+			return_0;
 
 		/* Lock VG to change on-disk metadata. */
 		/* If LVM1 driver knows about the VG, it can't be accessed. */
 		if (!check_lvm1_vg_inactive(cmd, vol))
-			return 0;
+			return_0;
 		break;
 	case LCK_LV:
 		/* All LV locks are non-blocking. */
@@ -455,18 +456,18 @@
 	strncpy(resource, vol, sizeof(resource));
 
 	if (!_lock_vol(cmd, resource, flags, lv_op))
-		return 0;
+		return_0;
 
 	/*
 	 * If a real lock was acquired (i.e. not LCK_CACHE),
 	 * perform an immediate unlock unless LCK_HOLD was requested.
 	 */
-	if (!(flags & LCK_CACHE) && !(flags & LCK_HOLD) &&
-	    ((flags & LCK_TYPE_MASK) != LCK_UNLOCK)) {
-		if (!_lock_vol(cmd, resource,
-			       (flags & ~LCK_TYPE_MASK) | LCK_UNLOCK, lv_op))
-			return 0;
-	}
+	if ((lck_type == LCK_NULL) || (lck_type == LCK_UNLOCK) ||
+	    (flags & (LCK_CACHE | LCK_HOLD)))
+		return 1;
+
+	if (!_lock_vol(cmd, resource, (flags & ~LCK_TYPE_MASK) | LCK_UNLOCK, lv_op))
+		return_0;
 
 	return 1;
 }


^ permalink raw reply	[flat|nested] 10+ messages in thread
* LVM2 ./WHATS_NEW lib/locking/locking.c
@ 2010-03-31 17:23 mbroz
  0 siblings, 0 replies; 10+ messages in thread
From: mbroz @ 2010-03-31 17:23 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2010-03-31 17:23:57

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

Log message:
	Always use blocking lock for VGs and orphan locks.
	
	Because we have now strong rule for lock ordering:
	- VG locks must be taken in alphabetical order
	- ORPHAN locks must be the last
	vgs_locked() is now not needed.
	
	This fixes problem with orphan locking, e.g.
	vgremove VG1    |    vgremove VG2
	lock(VG1)       |    lock(VG2)
	lock(ORPHAN)    |    lock(ORPHAN) -> fail, non-blocking
	
	https://bugzilla.redhat.com/show_bug.cgi?id=578413
	
	(More similar places in code.)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1497&r2=1.1498
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.75&r2=1.76

--- LVM2/WHATS_NEW	2010/03/31 17:23:18	1.1497
+++ LVM2/WHATS_NEW	2010/03/31 17:23:56	1.1498
@@ -1,5 +1,6 @@
 Version 2.02.63 -  
 ================================
+  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.
   Optimise PV segments search for the most last segment search case.
--- LVM2/lib/locking/locking.c	2010/03/05 14:48:34	1.75
+++ LVM2/lib/locking/locking.c	2010/03/31 17:23:57	1.76
@@ -420,11 +420,9 @@
 	switch (flags & LCK_SCOPE_MASK) {
 	case LCK_VG:
 		/*
-		 * Automatically set LCK_NONBLOCK if one or more VGs locked.
-		 * This will enforce correctness and prevent deadlocks rather
-		 * than relying on the caller to set the flag properly.
+		 * VG locks alphabetical, ORPHAN lock last
 		 */
-		if (!_blocking_supported || vgs_locked())
+		if (!_blocking_supported)
 			flags |= LCK_NONBLOCK;
 
 		if (vol[0] != '#' &&


^ permalink raw reply	[flat|nested] 10+ messages in thread
* LVM2 ./WHATS_NEW lib/locking/locking.c
@ 2010-01-13 17:40 mbroz
  0 siblings, 0 replies; 10+ messages in thread
From: mbroz @ 2010-01-13 17:40 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2010-01-13 17:40:18

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

Log message:
	Fix clvmd automatic target module loading crash.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1383&r2=1.1384
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.71&r2=1.72

--- LVM2/WHATS_NEW	2010/01/12 20:53:20	1.1383
+++ LVM2/WHATS_NEW	2010/01/13 17:40:17	1.1384
@@ -1,5 +1,6 @@
 Version 2.02.58 - 
 ===================================
+  Fix clvmd automatic target module loading crash.
   Fix allocation code not to stop at the first area of a PV that fits.
 
 Version 2.02.57 - 12th January 2010
--- LVM2/lib/locking/locking.c	2010/01/05 21:08:34	1.71
+++ LVM2/lib/locking/locking.c	2010/01/13 17:40:17	1.72
@@ -186,7 +186,8 @@
 	_vg_lock_count = 0;
 	_vg_write_lock_held = 0;
 
-	_locking.reset_locking();
+	if (_locking.reset_locking)
+		_locking.reset_locking();
 
 	if (was_locked)
 		_unblock_signals();


^ permalink raw reply	[flat|nested] 10+ messages in thread
* LVM2 ./WHATS_NEW lib/locking/locking.c
@ 2009-11-23 10:55 mbroz
  0 siblings, 0 replies; 10+ messages in thread
From: mbroz @ 2009-11-23 10:55 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2009-11-23 10:55:14

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

Log message:
	Fix memory lock imbalance in locking code.
	
	(This affects only cluster locking because only cluster
	locking module set LCK_PRE_MEMLOCK.)
	
	With currect code you get
	# vgchange -a n
	Internal error: _memlock_count has dropped below 0.
	when using cluster locking.
	
	It is caused by _unlock_memory calls here
	
	if ((flags & (LCK_SCOPE_MASK | LCK_TYPE_MASK)) == LCK_LV_RESUME)
	memlock_dec();
	
	Unfortunately it is also (wrongly) called in immediate unlock
	(when LCK_HOLD is not set) from lock_vol
	(LCK_UNLOCK is misinterpreted as LCK_LV_RESUME).
	
	Avoid this by comparing original flags and provide memlock
	code type of operation (suspend/resume).

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1321&r2=1.1322
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.66&r2=1.67

--- LVM2/WHATS_NEW	2009/11/23 10:44:50	1.1321
+++ LVM2/WHATS_NEW	2009/11/23 10:55:14	1.1322
@@ -1,5 +1,6 @@
 Version 2.02.56 - 
 ====================================
+  Fix memory lock imbalance in locking code.
   Revert vg_read_internal change, clvmd cannot use vg_read now. (2.02.55)
 
 Version 2.02.55 - 19th November 2009
--- LVM2/lib/locking/locking.c	2009/09/14 22:47:49	1.66
+++ LVM2/lib/locking/locking.c	2009/11/23 10:55:14	1.67
@@ -42,6 +42,12 @@
 static struct sigaction _oldhandler;
 static int _oldmasked;
 
+typedef enum {
+        LV_NOOP,
+        LV_SUSPEND,
+        LV_RESUME
+} lv_operation_t;
+
 static void _catch_sigint(int unused __attribute__((unused)))
 {
 	_sigint_caught = 1;
@@ -159,21 +165,21 @@
 	return;
 }
 
-static void _lock_memory(uint32_t flags)
+static void _lock_memory(lv_operation_t lv_op)
 {
 	if (!(_locking.flags & LCK_PRE_MEMLOCK))
 		return;
 
-	if ((flags & (LCK_SCOPE_MASK | LCK_TYPE_MASK)) == LCK_LV_SUSPEND)
+	if (lv_op == LV_SUSPEND)
 		memlock_inc();
 }
 
-static void _unlock_memory(uint32_t flags)
+static void _unlock_memory(lv_operation_t lv_op)
 {
 	if (!(_locking.flags & LCK_PRE_MEMLOCK))
 		return;
 
-	if ((flags & (LCK_SCOPE_MASK | LCK_TYPE_MASK)) == LCK_LV_RESUME)
+	if (lv_op == LV_RESUME)
 		memlock_dec();
 }
 
@@ -336,12 +342,13 @@
  * VG locking is by VG name.
  * FIXME This should become VG uuid.
  */
-static int _lock_vol(struct cmd_context *cmd, const char *resource, uint32_t flags)
+static int _lock_vol(struct cmd_context *cmd, const char *resource,
+		     uint32_t flags, lv_operation_t lv_op)
 {
 	int ret = 0;
 
 	_block_signals(flags);
-	_lock_memory(flags);
+	_lock_memory(lv_op);
 
 	assert(resource);
 
@@ -368,7 +375,7 @@
 		_update_vg_lock_count(resource, flags);
 	}
 
-	_unlock_memory(flags);
+	_unlock_memory(lv_op);
 	_unblock_signals();
 
 	return ret;
@@ -377,6 +384,18 @@
 int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags)
 {
 	char resource[258] __attribute((aligned(8)));
+	lv_operation_t lv_op;
+
+	switch (flags & (LCK_SCOPE_MASK | LCK_TYPE_MASK)) {
+		case LCK_LV_SUSPEND:
+				lv_op = LV_SUSPEND;
+				break;
+		case LCK_LV_RESUME:
+				lv_op = LV_RESUME;
+				break;
+		default:	lv_op = LV_NOOP;
+	}
+
 
 	if (flags == LCK_NONE) {
 		log_debug("Internal error: %s: LCK_NONE lock requested", vol);
@@ -416,7 +435,7 @@
 
 	strncpy(resource, vol, sizeof(resource));
 
-	if (!_lock_vol(cmd, resource, flags))
+	if (!_lock_vol(cmd, resource, flags, lv_op))
 		return 0;
 
 	/*
@@ -426,7 +445,7 @@
 	if (!(flags & LCK_CACHE) && !(flags & LCK_HOLD) &&
 	    ((flags & LCK_TYPE_MASK) != LCK_UNLOCK)) {
 		if (!_lock_vol(cmd, resource,
-			       (flags & ~LCK_TYPE_MASK) | LCK_UNLOCK))
+			       (flags & ~LCK_TYPE_MASK) | LCK_UNLOCK, lv_op))
 			return 0;
 	}
 


^ permalink raw reply	[flat|nested] 10+ messages in thread
* LVM2 ./WHATS_NEW lib/locking/locking.c
@ 2009-07-14 11:01 agk
  0 siblings, 0 replies; 10+ messages in thread
From: agk @ 2009-07-14 11:01 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2009-07-14 11:01:26

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

Log message:
	Exclude VG_GLOBAL from vg_write_lock_held so scans open devs read-only again. (mbroz)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1181&r2=1.1182
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.60&r2=1.61

--- LVM2/WHATS_NEW	2009/07/14 03:08:56	1.1181
+++ LVM2/WHATS_NEW	2009/07/14 11:01:26	1.1182
@@ -1,12 +1,13 @@
 Version 2.02.49 - 
 ================================
+  Exclude VG_GLOBAL from vg_write_lock_held so scans open devs read-only again.
   Add unit test case for liblvm VG create/delete APIs.
   Add liblvm APIs to implement creation and deletion of VGs.
-  Initialize cmd->cmd_line to "liblvm".
-  Place handles to liblvm objects for pv, vg, lv, lvseg, pvseg inside lvm.h
+  Initialize cmd->cmd_line to "liblvm" in new liblvm library.
+  Place handles to liblvm objects for pv, vg, lv, lvseg, pvseg inside lvm.h.
   Refactor vgsplit and vgextend to remove READ_REQUIRE_RESIZEABLE flag.
-  Changed exit() to _exit() after fork(); avoid flushing libc buffers twice.
-  Fixed invalid type being passed as printf argument on Sparc64.
+  Changed exit() to _exit() after fork() to avoid flushing libc buffers twice.
+  Add cast to log_info arg in _find_labeller to avoid Sparc64 warning.
   Make cmd->cmd_line const.
   Fix dev name mismatch in vgcreate man page example.
   Refactor vg_remove_single for use in liblvm.
--- LVM2/lib/locking/locking.c	2009/05/21 03:04:53	1.60
+++ LVM2/lib/locking/locking.c	2009/07/14 11:01:26	1.61
@@ -189,10 +189,12 @@
 		_unblock_signals();
 }
 
-static void _update_vg_lock_count(uint32_t flags)
+static void _update_vg_lock_count(const char *resource, uint32_t flags)
 {
+	/* Ignore locks not associated with updating VG metadata */
 	if ((flags & LCK_SCOPE_MASK) != LCK_VG ||
-	    (flags & LCK_CACHE))
+	    (flags & LCK_CACHE) ||
+	    !strcmp(resource, VG_GLOBAL))
 		return;
 
 	if ((flags & LCK_TYPE_MASK) == LCK_UNLOCK)
@@ -356,7 +358,7 @@
 								== LCK_READ);
 		}
 
-		_update_vg_lock_count(flags);
+		_update_vg_lock_count(resource, flags);
 	}
 
 	_unlock_memory(flags);


^ permalink raw reply	[flat|nested] 10+ messages in thread
* LVM2 ./WHATS_NEW lib/locking/locking.c
@ 2009-02-22 16:13 agk
  0 siblings, 0 replies; 10+ messages in thread
From: agk @ 2009-02-22 16:13 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2009-02-22 16:13:57

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

Log message:
	Fix interrupt unblocking after vgcreate, for example: drop_cached_metadata()
	previously left _vg_lock_count incremented.
	Other locks are always held during drop_cached_metadata() so there's no
	need to increment+decrement it.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1046&r2=1.1047
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.55&r2=1.56

--- LVM2/WHATS_NEW	2009/02/20 23:19:28	1.1046
+++ LVM2/WHATS_NEW	2009/02/22 16:13:57	1.1047
@@ -1,5 +1,6 @@
 Version 2.02.45 - 
 ===================================
+  Exclude LCK_CACHE locks from _vg_lock_count, fixing interrupt unblocking.
   Provide da and mda locations in debug message when writing text format label.
   Mention the restriction on file descriptors at invocation on the lvm man page.
   Index cached vgmetadata by vgid not vgname to cope with duplicate vgnames.
--- LVM2/lib/locking/locking.c	2009/02/03 16:23:19	1.55
+++ LVM2/lib/locking/locking.c	2009/02/22 16:13:57	1.56
@@ -191,7 +191,8 @@
 
 static void _update_vg_lock_count(uint32_t flags)
 {
-	if ((flags & LCK_SCOPE_MASK) != LCK_VG)
+	if ((flags & LCK_SCOPE_MASK) != LCK_VG ||
+	    (flags & LCK_CACHE))
 		return;
 
 	if ((flags & LCK_TYPE_MASK) == LCK_UNLOCK)


^ permalink raw reply	[flat|nested] 10+ messages in thread
* LVM2 ./WHATS_NEW lib/locking/locking.c
@ 2008-05-08 18:35 agk
  0 siblings, 0 replies; 10+ messages in thread
From: agk @ 2008-05-08 18:35 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2008-05-08 18:35:58

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

Log message:
	Avoid unnecessary unlock attempts with LCK_CACHE pseudo-locks.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.869&r2=1.870
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.47&r2=1.48

--- LVM2/WHATS_NEW	2008/05/08 18:28:27	1.869
+++ LVM2/WHATS_NEW	2008/05/08 18:35:58	1.870
@@ -5,6 +5,7 @@
 
 Version 2.02.37 - 
 =================================
+  Avoid unnecessary unlock attempts with LCK_CACHE pseudo-locks.
   When asked to drop cached committed VG metadata, invalidate cached PV labels.
   Drop metadata cache before writing precommitted metadata instead of after.
   Don't touch /dev in vgrename if activation is disabled.
--- LVM2/lib/locking/locking.c	2008/04/15 14:46:19	1.47
+++ LVM2/lib/locking/locking.c	2008/05/08 18:35:58	1.48
@@ -370,8 +370,12 @@
 	if (!_lock_vol(cmd, resource, flags))
 		return 0;
 
-	/* Perform immediate unlock unless LCK_HOLD set */
-	if (!(flags & LCK_HOLD) && ((flags & LCK_TYPE_MASK) != LCK_UNLOCK)) {
+	/*
+	 * If a real lock was acquired (i.e. not LCK_CACHE),
+	 * perform an immediate unlock unless LCK_HOLD was requested.
+	 */
+	if (!(flags & LCK_CACHE) && !(flags & LCK_HOLD) &&
+	    ((flags & LCK_TYPE_MASK) != LCK_UNLOCK)) {
 		if (!_lock_vol(cmd, resource,
 			       (flags & ~LCK_TYPE_MASK) | LCK_UNLOCK))
 			return 0;


^ permalink raw reply	[flat|nested] 10+ messages in thread
* LVM2 ./WHATS_NEW lib/locking/locking.c
@ 2006-10-14 16:37 agk
  0 siblings, 0 replies; 10+ messages in thread
From: agk @ 2006-10-14 16:37 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-10-14 16:37:55

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

Log message:
	Fall back to internal locking if external locking lib is missing or fails.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.469&r2=1.470
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/locking.c.diff?cvsroot=lvm2&r1=1.33&r2=1.34

--- LVM2/WHATS_NEW	2006/10/13 21:33:31	1.469
+++ LVM2/WHATS_NEW	2006/10/14 16:37:54	1.470
@@ -1,5 +1,6 @@
 Version 2.02.12 -
 ===================================
+  Fall back to internal locking if external locking lib is missing or fails.
   Retain activation state after changing LV minor number with --force.
   Propagate clustered flag in vgsplit and require resizeable flag.
 
--- LVM2/lib/locking/locking.c	2006/09/02 01:18:17	1.33
+++ LVM2/lib/locking/locking.c	2006/10/14 16:37:54	1.34
@@ -144,18 +144,18 @@
 	case 2:
 		if (!cmd->is_static) {
 			log_very_verbose("External locking selected.");
-			if (!init_external_locking(&_locking, cmd))
-				break;
-			return 1;
+			if (init_external_locking(&_locking, cmd))
+				return 1;
 		}
 		if (!find_config_tree_int(cmd, "locking/fallback_to_clustered_locking",
 					  DEFAULT_FALLBACK_TO_CLUSTERED_LOCKING))
 			break;
-		log_very_verbose("Falling back to clustered locking.");
-		/* Fall through */
 #endif
 
 #ifdef CLUSTER_LOCKING_INTERNAL
+		log_very_verbose("Falling back to internal clustered locking.");
+		/* Fall through */
+
 	case 3:
 		log_very_verbose("Cluster locking selected.");
 		if (!init_cluster_locking(&_locking, cmd))


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

end of thread, other threads:[~2012-03-27 15:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-10 16:07 LVM2 ./WHATS_NEW lib/locking/locking.c mbroz
  -- strict thread matches above, loose matches on Subject: below --
2012-03-27 15:53 mbroz
2011-01-13 14:56 zkabelac
2010-03-31 17:23 mbroz
2010-01-13 17:40 mbroz
2009-11-23 10:55 mbroz
2009-07-14 11:01 agk
2009-02-22 16:13 agk
2008-05-08 18:35 agk
2006-10-14 16:37 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).