From: teigland@sourceware.org <teigland@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/group/dlm_controld action.c dlm_daemon ...
Date: 9 Jan 2007 19:18:19 -0000 [thread overview]
Message-ID: <20070109191819.2459.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: teigland at sourceware.org 2007-01-09 19:18:19
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&only_with_tag=RHEL5&r1=1.8&r2=1.8.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/dlm_controld/dlm_daemon.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.5&r2=1.5.2.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/dlm_controld/main.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.6.2.1&r2=1.6.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/dlm_controld/member_cman.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.4.2.1&r2=1.4.2.2
--- cluster/group/dlm_controld/action.c 2006/10/24 16:16:31 1.8
+++ cluster/group/dlm_controld/action.c 2007/01/09 19:18:18 1.8.2.1
@@ -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:18:18 1.5.2.1
@@ -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:44:02 1.6.2.1
+++ cluster/group/dlm_controld/main.c 2007/01/09 19:18:18 1.6.2.2
@@ -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:57:35 1.4.2.1
+++ cluster/group/dlm_controld/member_cman.c 2007/01/09 19:18:18 1.4.2.2
@@ -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;
next reply other threads:[~2007-01-09 19:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-09 19:18 teigland [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-05-04 21:14 [Cluster-devel] cluster/group/dlm_controld action.c dlm_daemon teigland
2007-05-04 21:05 teigland
2007-04-23 15:31 teigland
2007-04-23 15:24 teigland
2007-01-09 19:17 teigland
2006-10-24 16:16 teigland
2006-10-05 7:52 pcaulfield
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070109191819.2459.qmail@sourceware.org \
--to=teigland@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).