ocfs2-tools/debug-ocfs2_hb_ctl.patch
OBS User autobuild b08edf399e Accepting request 42253 from network:ha-clustering:Factory
Copy from network:ha-clustering:Factory/ocfs2-tools based on submit request 42253 from user tserong

OBS-URL: https://build.opensuse.org/request/show/42253
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ocfs2-tools?expand=0&rev=25
2010-06-30 08:45:00 +00:00

105 lines
2.5 KiB
Diff

Index: ocfs2-tools/ocfs2_hb_ctl/ocfs2_hb_ctl.c
===================================================================
--- ocfs2-tools.orig/ocfs2_hb_ctl/ocfs2_hb_ctl.c
+++ ocfs2-tools/ocfs2_hb_ctl/ocfs2_hb_ctl.c
@@ -39,6 +39,7 @@
#include <string.h>
#include <sys/stat.h>
#include <signal.h>
+#include <syslog.h>
#include "ocfs2/ocfs2.h"
@@ -137,6 +138,7 @@ static errcode_t get_desc(const char *de
if (!region_desc->r_name || !region_desc->r_device_name)
err = OCFS2_ET_NO_MEMORY;
} else {
+ syslog(LOG_INFO, "filled heartbeat desc, err: %d\n", (int)err);
region_desc->r_name = NULL;
region_desc->r_device_name = NULL;
goto out_close;
@@ -157,6 +159,7 @@ static errcode_t get_desc(const char *de
err = OCFS2_ET_NO_MEMORY;
}
} else {
+ syslog(LOG_INFO, "filled cluster desc, err: %d\n", (int)err);
cluster_desc->c_stack = NULL;
cluster_desc->c_cluster = NULL;
}
@@ -202,9 +205,9 @@ static errcode_t compare_dev(const char
/* Any problem with getting the descriptor is NOT FOUND */
err = OCFS2_ET_FILE_NOT_FOUND;
- if (get_desc(device))
+ if (get_desc(device)) {
goto out;
-
+ }
if (!strcmp(region_desc->r_name, hbo->uuid_str)) {
hbo->dev_str = device;
err = 0;
@@ -381,12 +384,19 @@ static errcode_t stop_heartbeat(struct h
{
errcode_t err = 0;
- if (!hbo->dev_str)
+ if (!hbo->dev_str) {
err = lookup_dev(hbo);
+ if (err)
+ syslog(LOG_INFO, "looked up device, ret: %d\n",
+ (int)err);
+ }
if (!err) {
region_desc->r_persist = 1; /* hb_ctl is for reals */
region_desc->r_service = hbo->service;
err = o2cb_group_leave(cluster_desc, region_desc);
+ if (err)
+ syslog(LOG_INFO, "left group - err: %d\n",
+ (int)err);
}
return err;
@@ -536,14 +546,42 @@ static void print_usage(int err)
fprintf(output, " %s -h\n", progname);
}
+static int
+hack_enable_coredumps(void)
+{
+ struct rlimit rlim;
+
+ if (getrlimit(RLIMIT_CORE, &rlim) < 0) {
+ return -1;
+ }
+
+ rlim.rlim_max = RLIM_INFINITY;
+ setrlimit(RLIMIT_CORE, &rlim);
+ (void)chdir("/var/lib/openais");
+ return 0;
+}
+
+
int main(int argc, char **argv)
{
errcode_t err = 0;
int ret = 0;
+ int i;
struct hb_ctl_options hbo = {
.action = HB_ACTION_UNKNOWN,
};
char hbuuid[33];
+ char tmp[1024];
+
+ openlog("ocfs2_hb_ctl", LOG_CONS|LOG_NDELAY|LOG_PID, LOG_KERN);
+ sprintf(tmp, "ocfs2_hb_ctl");
+ for (i = 0; i < argc; i++) {
+ strncat(tmp, " ", sizeof(tmp)-1);
+ strncat(tmp, argv[i], sizeof(tmp)-1);
+ }
+ syslog(LOG_INFO, "%s\n", tmp);
+
+ hack_enable_coredumps();
setbuf(stdout, NULL);
setbuf(stderr, NULL);