[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH] Re-instate partial activation support in clustered mode.



Hi,

the patch from September 2008 (partial activation revamp) broke clustered
activation for the partial mode. This is currently more serious, since
lvconvert --repair relies on this functionality (see BZ 504699).

diff -rN -u -p old-upstream/lib/locking/cluster_locking.c new-upstream/lib/locking/cluster_locking.c
--- old-upstream/lib/locking/cluster_locking.c	2009-06-10 19:21:28.271381686 +0200
+++ new-upstream/lib/locking/cluster_locking.c	2009-06-10 19:21:28.575383173 +0200
@@ -24,6 +24,7 @@
 #include "lvm-string.h"
 #include "locking.h"
 #include "locking_types.h"
+#include "toolcontext.h"
 
 #include <assert.h>
 #include <stddef.h>
@@ -298,7 +299,8 @@ static int _cluster_free_request(lvm_res
 	return 1;
 }
 
-static int _lock_for_cluster(unsigned char clvmd_cmd, uint32_t flags, const char *name)
+static int _lock_for_cluster(struct cmd_context *cmd, unsigned char clvmd_cmd,
+			     uint32_t flags, const char *name)
 {
 	int status;
 	int i;
@@ -324,6 +326,9 @@ static int _lock_for_cluster(unsigned ch
 	if (dmeventd_monitor_mode())
 		args[1] |= LCK_DMEVENTD_MONITOR_MODE;
 
+	if (cmd->partial_activation)
+		args[1] |= LCK_PARTIAL_MODE;
+
 	/*
 	 * VG locks are just that: locks, and have no side effects
 	 * so we only need to do them on the local node because all
@@ -389,7 +394,7 @@ int lock_resource(struct cmd_context *cm
 		if (flags == LCK_VG_BACKUP) {
 			log_very_verbose("Requesting backup of VG metadata for %s",
 					 resource);
-			return _lock_for_cluster(CLVMD_CMD_VG_BACKUP,
+			return _lock_for_cluster(cmd, CLVMD_CMD_VG_BACKUP,
 						 LCK_CLUSTER_VG, resource);
 		}
 
@@ -453,7 +458,7 @@ int lock_resource(struct cmd_context *cm
 			 flags);
 
 	/* Send a message to the cluster manager */
-	return _lock_for_cluster(clvmd_cmd, flags, lockname);
+	return _lock_for_cluster(cmd, clvmd_cmd, flags, lockname);
 }
 
 static int decode_lock_type(const char *response)
diff -rN -u -p old-upstream/lib/locking/locking.h new-upstream/lib/locking/locking.h
--- old-upstream/lib/locking/locking.h	2009-06-10 19:21:28.275381916 +0200
+++ new-upstream/lib/locking/locking.h	2009-06-10 19:21:28.575383173 +0200
@@ -85,6 +85,7 @@ int check_lvm1_vg_inactive(struct cmd_co
 /*
  * Additional lock bits for cluster communication
  */
+#define LCK_PARTIAL_MODE        0x00000001U	/* Partial activation? */
 #define LCK_MIRROR_NOSYNC_MODE	0x00000002U	/* Mirrors don't require sync */
 #define LCK_DMEVENTD_MONITOR_MODE	0x00000004U	/* Register with dmeventd */
 

diff -rN -u -p old-upstream/daemons/clvmd/lvm-functions.c new-upstream/daemons/clvmd/lvm-functions.c
--- old-upstream/daemons/clvmd/lvm-functions.c	2009-06-10 19:21:28.419381851 +0200
+++ new-upstream/daemons/clvmd/lvm-functions.c	2009-06-10 19:21:28.619382061 +0200
@@ -478,6 +478,8 @@ int do_lock_lv(unsigned char command, un
 	if (!(lock_flags & LCK_DMEVENTD_MONITOR_MODE))
 		init_dmeventd_monitor(0);
 
+	cmd->partial_activation = (lock_flags & LCK_PARTIAL_MODE) ? 1 : 0;
+
 	switch (command) {
 	case LCK_LV_EXCLUSIVE:
 		status = do_activate_lv(resource, lock_flags, LKM_EXMODE);
Yours,
   Petr.

-- 
Peter Rockai | me()mornfall!net | prockai()redhat!com
 http://blog.mornfall.net | http://web.mornfall.net

"In My Egotistical Opinion, most people's C programs should be
 indented six feet downward and covered with dirt."
     -- Blair P. Houghton on the subject of C program indentation

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]