Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/locking/locking.c

PATCH [email protected] 1 participant 1 message May 8, 2008

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at 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

WHATS_NEW +1 -0
@@ -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.
lib/locking/locking.c +6 -2
@@ -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;