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

[Cluster-devel] cluster/group/dlm_controld action.c dlm_daemon ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Changes by:	teigland sourceware org	2007-01-09 19:17:08

Modified files:
	group/dlm_controld: action.c dlm_daemon.h main.c member_cman.c 

Log message:
	add -K option to enable dlm kernel log_debug's
	(does nothing if /sys/kernel/config/dlm/cluster/log_debug doesn't exist)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/dlm_controld/action.c.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/dlm_controld/dlm_daemon.h.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/dlm_controld/main.c.diff?cvsroot=cluster&r1=1.7&r2=1.8
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/dlm_controld/member_cman.c.diff?cvsroot=cluster&r1=1.5&r2=1.6

--- cluster/group/dlm_controld/action.c	2006/10/24 16:16:31	1.8
+++ cluster/group/dlm_controld/action.c	2007/01/09 19:17:08	1.9
@@ -42,6 +42,7 @@
 static int comms_nodes_count;
 
 #define DLM_SYSFS_DIR "/sys/kernel/dlm"
+#define CLUSTER_DIR   "/sys/kernel/config/dlm/cluster"
 #define SPACES_DIR    "/sys/kernel/config/dlm/cluster/spaces"
 #define COMMS_DIR     "/sys/kernel/config/dlm/cluster/comms"
 
@@ -525,15 +526,9 @@
 	rmdir("/sys/kernel/config/dlm/cluster");
 }
 
-int add_configfs_node(int nodeid, char *addr, int addrlen, int local)
+static int add_configfs_base(void)
 {
-	char path[PATH_MAX];
-	char padded_addr[sizeof(struct sockaddr_storage)];
-	char buf[32];
-	int rv, fd;
-
-	log_debug("set_configfs_node %d %s local %d",
-		  nodeid, str_ip(addr), local);
+	int rv = 0;
 
 	if (!path_exists("/sys/kernel/config")) {
 		log_error("No /sys/kernel/config, is configfs loaded?");
@@ -546,7 +541,24 @@
 	}
 
 	if (!path_exists("/sys/kernel/config/dlm/cluster"))
-		create_path("/sys/kernel/config/dlm/cluster");
+		rv = create_path("/sys/kernel/config/dlm/cluster");
+
+	return rv;
+}
+
+int add_configfs_node(int nodeid, char *addr, int addrlen, int local)
+{
+	char path[PATH_MAX];
+	char padded_addr[sizeof(struct sockaddr_storage)];
+	char buf[32];
+	int rv, fd;
+
+	log_debug("set_configfs_node %d %s local %d",
+		  nodeid, str_ip(addr), local);
+
+	rv = add_configfs_base();
+	if (rv < 0)
+		return rv;
 
 	/*
 	 * create comm dir for this node
@@ -649,3 +661,34 @@
 		log_error("%s: rmdir failed: %d", path, errno);
 }
 
+int set_configfs_debug(int val)
+{
+	char path[PATH_MAX];
+	char buf[32];
+	int fd, rv;
+
+	rv = add_configfs_base();
+	if (rv < 0)
+		return rv;
+
+	memset(path, 0, PATH_MAX);
+	snprintf(path, PATH_MAX, "%s/log_debug", CLUSTER_DIR);
+
+	fd = open(path, O_WRONLY);
+	if (fd < 0) {
+		log_debug("%s: open failed: %d", path, errno);
+		return fd;
+	}
+
+	memset(buf, 0, sizeof(buf));
+	snprintf(buf, 32, "%d", val);
+
+	rv = do_write(fd, buf, strlen(buf));
+	if (rv < 0) {
+		log_error("%s: write failed: %d", path, errno);
+		return rv;
+	}
+	close(fd);
+	return 0;
+}
+
--- cluster/group/dlm_controld/dlm_daemon.h	2006/10/24 16:16:31	1.5
+++ cluster/group/dlm_controld/dlm_daemon.h	2007/01/09 19:17:08	1.6
@@ -52,6 +52,7 @@
 
 extern char *prog_name;
 extern int daemon_debug_opt;
+extern int kernel_debug_opt;
 extern char daemon_debug_buf[256];
 
 #define log_debug(fmt, args...) \
@@ -81,6 +82,7 @@
 void clear_configfs(void);
 int set_members(char *name, int new_count, int *new_members);
 int set_id(char *name, uint32_t id);
+int set_configfs_debug(int val);
 
 /* member_xxx.c */
 int setup_member(void);
--- cluster/group/dlm_controld/main.c	2006/11/15 14:33:06	1.7
+++ cluster/group/dlm_controld/main.c	2007/01/09 19:17:08	1.8
@@ -12,7 +12,7 @@
 
 #include "dlm_daemon.h"
 
-#define OPTION_STRING			"DhV"
+#define OPTION_STRING			"KDhV"
 #define LOCKFILE_NAME			"/var/run/dlm_controld.pid"
 
 static int uevent_fd;
@@ -342,6 +342,7 @@
 	printf("Options:\n");
 	printf("\n");
 	printf("  -D	       Enable debugging code and don't fork\n");
+	printf("  -K	       Enable kernel dlm debugging messages\n");
 	printf("  -h	       Print this help, then exit\n");
 	printf("  -V	       Print program version information, then exit\n");
 }
@@ -360,6 +361,10 @@
 			daemon_debug_opt = 1;
 			break;
 
+		case 'K':
+			kernel_debug_opt = 1;
+			break;
+
 		case 'h':
 			print_usage();
 			exit(EXIT_SUCCESS);
@@ -426,4 +431,5 @@
 char *prog_name;
 int daemon_debug_opt;
 char daemon_debug_buf[256];
+int kernel_debug_opt;
 
--- cluster/group/dlm_controld/member_cman.c	2006/12/14 19:56:50	1.5
+++ cluster/group/dlm_controld/member_cman.c	2007/01/09 19:17:08	1.6
@@ -179,6 +179,8 @@
 
 	clear_configfs();
 
+	set_configfs_debug(kernel_debug_opt);
+
 	old_node_count = 0;
 	memset(&old_nodes, 0, sizeof(old_nodes));
 	cman_node_count = 0;


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