public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2/lib/locking cluster_locking.c
@ 2011-12-08 18:19 agk
  0 siblings, 0 replies; 9+ messages in thread
From: agk @ 2011-12-08 18:19 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2011-12-08 18:19:05

Modified files:
	lib/locking    : cluster_locking.c 

Log message:
	Don't pass LCK_LOCAL to clvmd - it's unused.
	Pass LCK_CLUSTER_VG in args[0] instead of args[1].

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/cluster_locking.c.diff?cvsroot=lvm2&r1=1.62&r2=1.63

--- LVM2/lib/locking/cluster_locking.c	2011/11/30 17:02:37	1.62
+++ LVM2/lib/locking/cluster_locking.c	2011/12/08 18:19:05	1.63
@@ -320,9 +320,10 @@
 	args = alloca(len);
 	strcpy(args + 2, name);
 
-	/* Mask off lock flags */
-	args[0] = flags & (LCK_SCOPE_MASK | LCK_TYPE_MASK | LCK_NONBLOCK | LCK_HOLD); 
-	args[1] = flags & (LCK_LOCAL | LCK_CLUSTER_VG);
+	/* args[0] holds bottom 8 bits except LCK_LOCAL (0x40). */
+	args[0] = flags & (LCK_SCOPE_MASK | LCK_TYPE_MASK | LCK_NONBLOCK | LCK_HOLD | LCK_CLUSTER_VG); 
+
+	args[1] = 0;
 
 	if (flags & LCK_ORIGIN_ONLY)
 		args[1] |= LCK_ORIGIN_ONLY_MODE;
@@ -492,7 +493,7 @@
 		return 0;
 	}
 
-	log_very_verbose("Locking %s %s %s (%s%s%s%s%s%s%s) (0x%x)", lock_scope, lockname,
+	log_very_verbose("Locking %s %s %s (%s%s%s%s%s%s%s%s) (0x%x)", lock_scope, lockname,
 			 lock_type, lock_scope,
 			 flags & LCK_NONBLOCK ? "|NONBLOCK" : "",
 			 flags & LCK_HOLD ? "|HOLD" : "",
@@ -500,6 +501,7 @@
 			 flags & LCK_CLUSTER_VG ? "|CLUSTER" : "",
 			 flags & LCK_CACHE ? "|CACHE" : "",
 			 flags & LCK_ORIGIN_ONLY ? "|ORIGIN_ONLY" : "",
+			 flags & LCK_REVERT ? "|REVERT" : "",
 			 flags);
 
 	/* Send a message to the cluster manager */


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

* LVM2/lib/locking cluster_locking.c
@ 2011-11-30 17:02 mornfall
  0 siblings, 0 replies; 9+ messages in thread
From: mornfall @ 2011-11-30 17:02 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2011-11-30 17:02:38

Modified files:
	lib/locking    : cluster_locking.c 

Log message:
	Update comment on LCK_*DMEVENTD*.

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

--- LVM2/lib/locking/cluster_locking.c	2011/11/30 17:00:57	1.61
+++ LVM2/lib/locking/cluster_locking.c	2011/11/30 17:02:37	1.62
@@ -337,8 +337,9 @@
 		args[1] |= LCK_TEST_MODE;
 
 	/*
-	 * Must handle tri-state return from dmeventd_monitor_mode.
-	 * But DMEVENTD_MONITOR_IGNORE is not propagated across the cluster.
+	 * We propagate dmeventd_monitor_mode() to clvmd faithfully, since
+	 * dmeventd monitoring is tied to activation which happens inside clvmd
+	 * when locking_type = 3.
 	 */
 	dmeventd_mode = dmeventd_monitor_mode();
 	if (dmeventd_mode == DMEVENTD_MONITOR_IGNORE)


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

* LVM2/lib/locking cluster_locking.c
@ 2011-02-02 23:57 agk
  0 siblings, 0 replies; 9+ messages in thread
From: agk @ 2011-02-02 23:57 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2011-02-02 23:57:48

Modified files:
	lib/locking    : cluster_locking.c 

Log message:
	a few more comments

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/cluster_locking.c.diff?cvsroot=lvm2&r1=1.52&r2=1.53

--- LVM2/lib/locking/cluster_locking.c	2011/02/02 23:39:39	1.52
+++ LVM2/lib/locking/cluster_locking.c	2011/02/02 23:57:48	1.53
@@ -342,10 +342,14 @@
 	 * VG locks are just that: locks, and have no side effects
 	 * so we only need to do them on the local node because all
 	 * locks are cluster-wide.
+	 *
 	 * Also, if the lock is exclusive it makes no sense to try to
 	 * acquire it on all nodes, so just do that on the local node too.
-	 * One exception, is that P_ locks (except VG_SYNC_NAMES) /do/ get 
-	 * distributed across the cluster because they might have side-effects.
+	 *
+	 * P_ locks /do/ get distributed across the cluster because they might
+	 * have side-effects.
+	 *
+	 * SYNC_NAMES and VG_BACKUP use the VG name directly without prefix.
 	 */
 	if (clvmd_cmd == CLVMD_CMD_SYNC_NAMES) {
 		if (flags & LCK_LOCAL)


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

* LVM2/lib/locking cluster_locking.c
@ 2011-02-01 17:31 jbrassow
  0 siblings, 0 replies; 9+ messages in thread
From: jbrassow @ 2011-02-01 17:31 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	jbrassow@sourceware.org	2011-02-01 17:31:40

Modified files:
	lib/locking    : cluster_locking.c 

Log message:
	fix bad 'strcmp's in 'decode_lock_type' - missing !'s
	
	There was no effect from having this wrong yet, because the
	tree of callers only ever cared about the answer to the first
	condition (!response), which determines whether a lock is
	held or not.  Correct responses, however, are needed soon.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/cluster_locking.c.diff?cvsroot=lvm2&r1=1.50&r2=1.51

--- LVM2/lib/locking/cluster_locking.c	2011/01/28 10:16:04	1.50
+++ LVM2/lib/locking/cluster_locking.c	2011/02/01 17:31:40	1.51
@@ -490,11 +490,11 @@
 {
 	if (!response)
 		return LCK_NULL;
-	else if (strcmp(response, "EX"))
+	else if (!strcmp(response, "EX"))
 		return LCK_EXCL;
-	else if (strcmp(response, "CR"))
+	else if (!strcmp(response, "CR"))
 		return LCK_READ;
-	else if (strcmp(response, "PR"))
+	else if (!strcmp(response, "PR"))
 		return LCK_PREAD;
 
 	stack;
@@ -532,8 +532,8 @@
 
 		/*
 		 * All nodes should use CR, or exactly one node
-		 * should held EX. (PR is obsolete)
-		 * If two nodes node reports different locks,
+		 * should hold EX. (PR is obsolete)
+		 * If two nodes report different locks,
 		 * something is broken - just return more important mode.
 		 */
 		if (decode_lock_type(response[i].response) > *mode)


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

* LVM2/lib/locking cluster_locking.c
@ 2010-11-29 11:13 zkabelac
  0 siblings, 0 replies; 9+ messages in thread
From: zkabelac @ 2010-11-29 11:13 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2010-11-29 11:13:12

Modified files:
	lib/locking    : cluster_locking.c 

Log message:
	Remove dead assignment in _lock_for_cluster
	
	'saved_errno' is not read from this initialization and before its
	usage is assigned again before _cluster_free_request() call.

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

--- LVM2/lib/locking/cluster_locking.c	2010/08/17 19:25:05	1.46
+++ LVM2/lib/locking/cluster_locking.c	2010/11/29 11:13:12	1.47
@@ -308,7 +308,7 @@
 	const char *node = "";
 	int len;
 	int dmeventd_mode;
-	int saved_errno = errno;
+	int saved_errno;
 	lvm_response_t *response = NULL;
 	int num_responses;
 


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

* LVM2/lib/locking cluster_locking.c
@ 2009-12-09 18:28 mbroz
  0 siblings, 0 replies; 9+ messages in thread
From: mbroz @ 2009-12-09 18:28 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2009-12-09 18:28:27

Modified files:
	lib/locking    : cluster_locking.c 

Log message:
	Get rid of magic masks in cluster locking code.
	
	Patch should not cause any problems, only real change is
	removing LCK_LOCAL bit from lock type flag, it is never used there.
	(LCK_LOCAL is part arg[1] bits anyway.)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/cluster_locking.c.diff?cvsroot=lvm2&r1=1.37&r2=1.38

--- LVM2/lib/locking/cluster_locking.c	2009/12/09 18:16:38	1.37
+++ LVM2/lib/locking/cluster_locking.c	2009/12/09 18:28:27	1.38
@@ -317,8 +317,9 @@
 	args = alloca(len);
 	strcpy(args + 2, name);
 
-	args[0] = flags & 0x7F; /* Maskoff lock flags */
-	args[1] = flags & 0xC0; /* Bitmap flags */
+	/* Maskoff lock flags */
+	args[0] = flags & (LCK_SCOPE_MASK | LCK_TYPE_MASK | LCK_NONBLOCK | LCK_HOLD); 
+	args[1] = flags & (LCK_LOCAL | LCK_CLUSTER_VG);
 
 	if (mirror_in_sync())
 		args[1] |= LCK_MIRROR_NOSYNC_MODE;


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

* LVM2/lib/locking cluster_locking.c
@ 2009-12-09 18:16 mbroz
  0 siblings, 0 replies; 9+ messages in thread
From: mbroz @ 2009-12-09 18:16 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2009-12-09 18:16:38

Modified files:
	lib/locking    : cluster_locking.c 

Log message:
	Get rid of hardcoded 0xffdf cluster lock flag.
	
	There is hidded change - the upper flags (0xffff0000)
	and now not cleared, but there are unused anyway.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/cluster_locking.c.diff?cvsroot=lvm2&r1=1.36&r2=1.37

--- LVM2/lib/locking/cluster_locking.c	2009/06/12 08:30:19	1.36
+++ LVM2/lib/locking/cluster_locking.c	2009/12/09 18:16:38	1.37
@@ -415,7 +415,7 @@
 		clvmd_cmd = CLVMD_CMD_LOCK_LV;
 		strcpy(lockname, resource);
 		lock_scope = "LV";
-		flags &= 0xffdf;	/* Mask off HOLD flag */
+		flags &= ~LCK_HOLD;	/* Mask off HOLD flag */
 		break;
 
 	default:


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

* LVM2/lib/locking cluster_locking.c
@ 2008-12-16 12:30 wysochanski
  0 siblings, 0 replies; 9+ messages in thread
From: wysochanski @ 2008-12-16 12:30 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2008-12-16 12:30:40

Modified files:
	lib/locking    : cluster_locking.c 

Log message:
	Rename 'cmd' to 'clvmd_cmd' to remove ambiguity.
	
	Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
	Acked-by: James Cameron <james.cameron@hp.com>
	Acked-by: Alasdair G Kergon <agk@redhat.com>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/cluster_locking.c.diff?cvsroot=lvm2&r1=1.31&r2=1.32

--- LVM2/lib/locking/cluster_locking.c	2008/11/04 15:07:44	1.31
+++ LVM2/lib/locking/cluster_locking.c	2008/12/16 12:30:39	1.32
@@ -164,10 +164,11 @@
 }
 
 /* Build the structure header and parse-out wildcard node names */
-static void _build_header(struct clvm_header *head, int cmd, const char *node,
+/* FIXME: Cleanup implicit casts of clvmd_cmd (int, char, uint8_t, etc). */
+static void _build_header(struct clvm_header *head, int clvmd_cmd, const char *node,
 			  int len)
 {
-	head->cmd = cmd;
+	head->cmd = clvmd_cmd;
 	head->status = 0;
 	head->flags = 0;
 	head->clientid = 0;
@@ -193,7 +194,7 @@
 /*
  * Send a message to a(or all) node(s) in the cluster and wait for replies
  */
-static int _cluster_request(char cmd, const char *node, void *data, int len,
+static int _cluster_request(char clvmd_cmd, const char *node, void *data, int len,
 			   lvm_response_t ** response, int *num)
 {
 	char outbuf[sizeof(struct clvm_header) + len + strlen(node) + 1] __attribute((aligned(8)));
@@ -213,7 +214,7 @@
 	if (_clvmd_sock == -1)
 		return 0;
 
-	_build_header(head, cmd, node, len);
+	_build_header(head, clvmd_cmd, node, len);
 	memcpy(head->node + strlen(head->node) + 1, data, len);
 
 	status = _send_request(outbuf, sizeof(struct clvm_header) +
@@ -296,7 +297,7 @@
 	return 1;
 }
 
-static int _lock_for_cluster(unsigned char cmd, uint32_t flags, const char *name)
+static int _lock_for_cluster(unsigned char clvmd_cmd, uint32_t flags, const char *name)
 {
 	int status;
 	int i;
@@ -332,13 +333,13 @@
 	 * the cluster because they might have side-effects.
 	 */
 	if (strncmp(name, "P_", 2) &&
-	    (cmd == CLVMD_CMD_LOCK_VG ||
+	    (clvmd_cmd == CLVMD_CMD_LOCK_VG ||
 	     (flags & LCK_TYPE_MASK) == LCK_EXCL ||
 	     (flags & LCK_LOCAL) ||
 	     !(flags & LCK_CLUSTER_VG)))
 		node = ".";
 
-	status = _cluster_request(cmd, node, args, len,
+	status = _cluster_request(clvmd_cmd, node, args, len,
 				  &response, &num_responses);
 
 	/* If any nodes were down then display them and return an error */
@@ -375,7 +376,7 @@
 #endif
 {
 	char lockname[PATH_MAX];
-	int cluster_cmd = 0;
+	int clvmd_cmd = 0;
 	const char *lock_scope;
 	const char *lock_type = "";
 
@@ -393,12 +394,12 @@
 				    resource);
 
 		lock_scope = "VG";
-		cluster_cmd = CLVMD_CMD_LOCK_VG;
+		clvmd_cmd = CLVMD_CMD_LOCK_VG;
 		flags &= LCK_TYPE_MASK;
 		break;
 
 	case LCK_LV:
-		cluster_cmd = CLVMD_CMD_LOCK_LV;
+		clvmd_cmd = CLVMD_CMD_LOCK_LV;
 		strcpy(lockname, resource);
 		lock_scope = "LV";
 		flags &= 0xffdf;	/* Mask off HOLD flag */
@@ -436,7 +437,7 @@
 	}
 
 	/* If we are unlocking a clustered VG, then trigger remote metadata backups */
-	if (cluster_cmd == CLVMD_CMD_LOCK_VG &&
+	if (clvmd_cmd == CLVMD_CMD_LOCK_VG &&
 	    ((flags & LCK_TYPE_MASK) == LCK_UNLOCK) &&
 	    (flags & LCK_CLUSTER_VG)) {
 		log_very_verbose("Requesing backup of VG metadata for %s", resource);
@@ -452,7 +453,7 @@
 			 flags);
 
 	/* Send a message to the cluster manager */
-	return _lock_for_cluster(cluster_cmd, flags, lockname);
+	return _lock_for_cluster(clvmd_cmd, flags, lockname);
 }
 
 #ifdef CLUSTER_LOCKING_INTERNAL


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

* LVM2/lib/locking cluster_locking.c
@ 2006-05-12 13:33 agk
  0 siblings, 0 replies; 9+ messages in thread
From: agk @ 2006-05-12 13:33 UTC (permalink / raw)
  To: lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-05-12 13:33:22

Modified files:
	lib/locking    : cluster_locking.c 

Log message:
	fix compile

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/locking/cluster_locking.c.diff?cvsroot=lvm2&r1=1.9&r2=1.10


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

end of thread, other threads:[~2011-12-08 18:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-08 18:19 LVM2/lib/locking cluster_locking.c agk
  -- strict thread matches above, loose matches on Subject: below --
2011-11-30 17:02 mornfall
2011-02-02 23:57 agk
2011-02-01 17:31 jbrassow
2010-11-29 11:13 zkabelac
2009-12-09 18:28 mbroz
2009-12-09 18:16 mbroz
2008-12-16 12:30 wysochanski
2006-05-12 13:33 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).