Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.3
ocfs2-tools
extra-debug.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File extra-debug.patch of Package ocfs2-tools
--- ocfs2_controld/ckpt.c | 2 - ocfs2_controld/main.c | 53 ++++++++++++++++++++++++++++++++++------ ocfs2_controld/mount.c | 2 + ocfs2_controld/ocfs2_controld.h | 1 ocfs2_controld/pacemaker.c | 2 - 5 files changed, 51 insertions(+), 9 deletions(-) Index: ocfs2-tools/ocfs2_controld/ckpt.c =================================================================== --- ocfs2-tools.orig/ocfs2_controld/ckpt.c 2012-08-24 10:02:19.000000000 -0500 +++ ocfs2-tools/ocfs2_controld/ckpt.c 2012-08-24 10:14:42.000000000 -0500 @@ -413,7 +413,7 @@ static int call_section_read(struct ckpt /* -ENOENT is a clean error for the caller to handle */ if (rc == -ENOENT) { - log_debug("Checkpoint \"%.*s\" does not have a " + log_error("Checkpoint \"%.*s\" does not have a " "section named \"%s\"", handle->ch_name.length, handle->ch_name.value, name); Index: ocfs2-tools/ocfs2_controld/main.c =================================================================== --- ocfs2-tools.orig/ocfs2_controld/main.c 2012-08-24 10:02:19.000000000 -0500 +++ ocfs2-tools/ocfs2_controld/main.c 2012-08-24 10:14:42.000000000 -0500 @@ -74,7 +74,7 @@ static int time_to_die = 0; static int sigpipe_write_fd; char *prog_name; -int daemon_debug_opt; +int daemon_debug_opt = 0; char daemon_debug_buf[1024]; char dump_buf[DUMP_SIZE]; int dump_point; @@ -1030,8 +1030,7 @@ static void lockfile(void) fd = open(LOCKFILE_NAME, O_CREAT|O_WRONLY, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); if (fd < 0) { - fprintf(stderr, "cannot open/create lock file %s\n", - LOCKFILE_NAME); + log_error("cannot open/create lock file %s", LOCKFILE_NAME); exit(EXIT_FAILURE); } @@ -1042,13 +1041,13 @@ static void lockfile(void) error = fcntl(fd, F_SETLK, &lock); if (error) { - fprintf(stderr, "ocfs2_controld is already running\n"); + log_error("ocfs2_controld is already running"); exit(EXIT_FAILURE); } error = ftruncate(fd, 0); if (error) { - fprintf(stderr, "cannot clear lock file %s\n", LOCKFILE_NAME); + log_error("cannot clear lock file %s", LOCKFILE_NAME); exit(EXIT_FAILURE); } @@ -1056,7 +1055,7 @@ static void lockfile(void) error = write(fd, buf, strlen(buf)); if (error <= 0) { - fprintf(stderr, "cannot write lock file %s\n", LOCKFILE_NAME); + log_error("cannot write lock file %s", LOCKFILE_NAME); exit(EXIT_FAILURE); } } @@ -1066,13 +1065,13 @@ static void daemonize(void) int fd; pid_t pid = fork(); if (pid < 0) { + log_error("main: cannot fork"); perror("main: cannot fork"); exit(EXIT_FAILURE); } if (pid) exit(EXIT_SUCCESS); setsid(); - chdir("/"); umask(0); close(0); close(1); @@ -1143,6 +1142,7 @@ static void decode_arguments(int argc, c break; default: + log_error("unknown option: %c\n", optchar); fprintf(stderr, "unknown option: %c\n", optchar); exit(EXIT_FAILURE); break; @@ -1180,12 +1180,53 @@ static void set_scheduler(void) } } +#include <sys/time.h> +#include <sys/resource.h> + +static int +hack_enable_coredumps(void) +{ + int rc; + struct rlimit rlim; + int doenable = 1; + + if ((rc = getrlimit(RLIMIT_CORE, &rlim)) < 0) { + int errsave = errno; + log_error("Cannot get current core limit value. %d", errsave); + errno = errsave; + return rc; + } + if (rlim.rlim_max == 0 && geteuid() == 0) { + rlim.rlim_max = RLIM_INFINITY; + } + + rlim.rlim_cur = (doenable ? rlim.rlim_max : 0); + + if (doenable && rlim.rlim_max == 0) { + log_error("Not possible to enable core dumps (rlim_max is 0)"); + } + + if ((rc = setrlimit(RLIMIT_CORE, &rlim)) < 0) { + int errsave = errno; + log_error("Unable to enable core dumps: %d", errsave); + errno = errsave; + return rc; + } + chdir("/var/lib/openais"); + log_debug("Core dumps enabled: /var/lib/openais"); + return 0; +} + int main(int argc, char **argv) { errcode_t err; prog_name = argv[0]; const char *stack = NULL; + decode_arguments(argc, argv); + + hack_enable_coredumps(); + init_mounts(); initialize_o2cb_error_table(); @@ -1201,13 +1242,11 @@ int main(int argc, char **argv) return 1; } if (strcmp(stack, stackname)) { - fprintf(stderr, "%s: This daemon supports the \"%s\" stack, but the \"%s\" stack is in use\n", - prog_name, stackname, stack); + log_error("%s: This daemon supports the \"%s\" stack, but the \"%s\" stack is in use", + prog_name, stackname, stack); return 1; } - decode_arguments(argc, argv); - if (!daemon_debug_opt) daemonize(); Index: ocfs2-tools/ocfs2_controld/mount.c =================================================================== --- ocfs2-tools.orig/ocfs2_controld/mount.c 2012-08-24 10:02:19.000000000 -0500 +++ ocfs2-tools/ocfs2_controld/mount.c 2012-08-24 10:14:42.000000000 -0500 @@ -176,6 +176,8 @@ static void notify_mount_client(struct m else mg->mg_mount_notified = 1; + log_debug("Notified client: %d", mg->mg_mount_notified); + /* * XXX If we failed to notify the client, what can we do? I'm * guessing that our main loop will get POLLHUP and we'll clean Index: ocfs2-tools/ocfs2_controld/ocfs2_controld.h =================================================================== --- ocfs2-tools.orig/ocfs2_controld/ocfs2_controld.h 2012-08-24 10:14:40.000000000 -0500 +++ ocfs2-tools/ocfs2_controld/ocfs2_controld.h 2012-08-24 10:14:42.000000000 -0500 @@ -60,6 +60,7 @@ do { \ #define log_error(fmt, args...) \ do { \ log_debug(fmt, ##args); \ + fprintf(stderr, fmt "\n", ##args); \ syslog(LOG_ERR, fmt, ##args); \ } while (0)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor