From: bmarzins@sourceware.org <bmarzins@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/gulm Makefile src/core_main.c src/gulm ...
Date: 14 Sep 2006 20:28:34 -0000 [thread overview]
Message-ID: <20060914202834.9024.qmail@sourceware.org> (raw)
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL4U4
Changes by: bmarzins at sourceware.org 2006-09-14 20:28:30
Modified files:
gulm : Makefile
gulm/src : core_main.c gulm_defines.h lock_main.c
ltpx_main.c main_main.c
Added files:
gulm/src : log.c log.h
Log message:
This fixes bz 206160 (the RHEL4 version of the INRA bug). Gulm now is locked
into memory and has a seperate thread responsible for writing to syslog. This
keeps it from blocking while under memory pressure, so heartbeats can still get
out.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gulm/Makefile.diff?cvsroot=cluster&only_with_tag=RHEL4U4&r1=1.8.2.7&r2=1.8.2.7.6.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gulm/src/log.c.diff?cvsroot=cluster&only_with_tag=RHEL4U4&r1=NONE&r2=1.1.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gulm/src/log.h.diff?cvsroot=cluster&only_with_tag=RHEL4U4&r1=NONE&r2=1.1.4.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gulm/src/core_main.c.diff?cvsroot=cluster&only_with_tag=RHEL4U4&r1=1.4&r2=1.4.14.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gulm/src/gulm_defines.h.diff?cvsroot=cluster&only_with_tag=RHEL4U4&r1=1.2&r2=1.2.14.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gulm/src/lock_main.c.diff?cvsroot=cluster&only_with_tag=RHEL4U4&r1=1.4&r2=1.4.14.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gulm/src/ltpx_main.c.diff?cvsroot=cluster&only_with_tag=RHEL4U4&r1=1.4.2.1&r2=1.4.2.1.12.1
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/gulm/src/main_main.c.diff?cvsroot=cluster&only_with_tag=RHEL4U4&r1=1.5.2.1&r2=1.5.2.1.12.1
--- cluster/gulm/Attic/Makefile 2005/05/02 13:03:36 1.8.2.7
+++ cluster/gulm/Attic/Makefile 2006/09/14 20:28:30 1.8.2.7.6.1
@@ -25,6 +25,7 @@
src/core_resources.c \
src/hash.c \
src/hashn.c \
+ src/log.c \
src/lock_io.c \
src/lock_main.c \
src/lock_space.c \
@@ -83,7 +84,7 @@
all: src/lock_gulmd src/gulm_tool lib/libgulm.a lib/libgulm.so lib/libgulm.so.$(RELEASE_MAJOR)
src/lock_gulmd: $(gulmd_src:.c=.o)
- ${CC} ${CFLAGS} ${LDFLAGS} $^ ${LDLIBS} -lccs -o $@
+ ${CC} ${CFLAGS} ${LDFLAGS} $^ ${LDLIBS} -lccs -pthread -o $@
lib/libgulm.a: $(lib_src:.c=.o)
${AR} cr $@ $^
--- cluster/gulm/src/Attic/core_main.c 2004/10/29 20:55:58 1.4
+++ cluster/gulm/src/Attic/core_main.c 2006/09/14 20:28:30 1.4.14.1
@@ -25,6 +25,7 @@
#include <signal.h>
#include <sys/wait.h>
#include <sys/time.h>
+#include <sys/mman.h>
#include <execinfo.h>
#include "gulm_defines.h"
@@ -171,6 +172,14 @@
}
+static int gulm_mlockall(void)
+{
+ int res = mlockall(MCL_CURRENT | MCL_FUTURE);
+ if (res)
+ log_err("could not lock memory : %s\n", strerror(errno));
+ return res;
+}
+
/**
* core_main -
* @argc:
@@ -199,6 +208,9 @@
die(ExitGulm_InitFailed, "open listener failed. %d:%s\n",
errno, strerror(errno));
+ if( gulm_mlockall() != 0 )
+ die(ExitGulm_InitFailed, "could not lock memory.\n");
+ log_init(0,0);
/* ok, Now get to work. */
work_loop();
--- cluster/gulm/src/Attic/gulm_defines.h 2004/06/28 19:00:22 1.2
+++ cluster/gulm/src/Attic/gulm_defines.h 2006/09/14 20:28:30 1.2.14.1
@@ -22,6 +22,7 @@
#include <stdint.h>
#include <inttypes.h>
#include "osi_endian.h" /* because cpu_to_beXX() is damn nice. */
+#include "log.h"
#if !defined(TRUE) || !defined(FALSE)
#undef TRUE
@@ -57,38 +58,6 @@
#define ExitGulm_BadLogic (60)
#define ExitGulm_Assertion (61)
-#include "gulm_log_msg_bits.h"
-
-/* no syslog if debugging. */
-#ifndef DEBUG
-#include <syslog.h>
-#define log_msg(v, fmt, args...) if(((v)&verbosity)==(v)||(v)==lgm_Always) {\
- syslog(LOG_NOTICE, fmt , ## args );}
-#define log_err(fmt, args...){ \
- syslog(LOG_ERR, "ERROR [%s:%d] " fmt , __FILE__ , __LINE__ , ## args ); }
-#define log_bug(fmt, args...) { \
- syslog(LOG_NOTICE, "BUG[%s:%d] " fmt , __FILE__ , __LINE__ , ## args ); }
-#define die(ext, fmt, args...) { \
- fprintf(stderr, "In %s:%d (%s) death by:\n" fmt , __FILE__ , \
- __LINE__ , RELEASE , ## args ); \
- syslog(LOG_ERR, "In %s:%d (%s) death by:\n" fmt , __FILE__ , \
- __LINE__ , RELEASE , ## args ); exit(ext);}
-#define TICK log_bug("TICK.\n")
-#else /*DEBUG*/
-#define log_msg(v, fmt, args...) if(((v)&verbosity)==(v)||(v)==lgm_Always){ \
- fprintf(stdout, "%s: " fmt , ProgramName , ## args ); }
-#define log_err(fmt, args...) {\
- fprintf(stderr, "ERROR [%s:%s:%d] " fmt , ProgramName , __FILE__ , \
- __LINE__ , ## args ); }
-#define log_bug(fmt, args...) {\
- fprintf(stderr, "[bug:%s:%s:%d] " fmt , ProgramName , __FILE__ , \
- __LINE__ , ## args ); }
-#define die(ext, fmt, args...) {\
- fprintf(stderr, "In %s:%d (%s) death by:\n" fmt , __FILE__ , \
- __LINE__ , RELEASE , ## args ); exit(ext);}
-#define TICK log_bug("TICK.\n")
-#endif /*DEBUG*/
-
#define GULMD_ASSERT(x, action) { if( ! (x) ) {\
void *array[200]; \
--- cluster/gulm/src/Attic/lock_main.c 2004/12/17 14:01:58 1.4
+++ cluster/gulm/src/Attic/lock_main.c 2006/09/14 20:28:30 1.4.14.1
@@ -201,6 +201,7 @@
pid_lock(gulm_config.lock_file, ProgramName);
#endif
+ log_init(0,0);
log_msg(lgm_Network2, "Locktable %d started.\n", LTid);
/* we're the child of a daemon, so we've been daemonized.
--- cluster/gulm/src/Attic/ltpx_main.c 2005/02/18 15:31:10 1.4.2.1
+++ cluster/gulm/src/Attic/ltpx_main.c 2006/09/14 20:28:30 1.4.2.1.12.1
@@ -149,6 +149,7 @@
pid_lock(gulm_config.lock_file, ProgramName);
#endif
+ log_init(0,0);
log_msg(lgm_Network2, "ltpx started.\n");
init_ltpx_poller();
--- cluster/gulm/src/Attic/main_main.c 2005/01/10 15:59:41 1.5.2.1
+++ cluster/gulm/src/Attic/main_main.c 2006/09/14 20:28:30 1.5.2.1.12.1
@@ -16,6 +16,8 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/resource.h>
#include <fcntl.h>
#include <errno.h>
#include <execinfo.h>
@@ -192,6 +194,19 @@
+static int set_limits(void)
+{
+ int res;
+ struct rlimit rlimit;
+
+ rlimit.rlim_cur = RLIM_INFINITY;
+ rlimit.rlim_max = RLIM_INFINITY;
+ res = setrlimit (RLIMIT_MEMLOCK, &rlimit);
+ if (res)
+ fprintf(stderr, "cannot set RLIMIT_MEMLOCK: %s\n", strerror(errno));
+ return res;
+}
+
/**
* main -
* @argc:
@@ -236,6 +251,9 @@
}
/* daemonize ourselves here */
+
+ if (set_limits() != 0) return -1;
+
become_nobody();
set_myID();
next reply other threads:[~2006-09-14 20:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-14 20:28 bmarzins [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-09-14 20:08 [Cluster-devel] cluster/gulm Makefile src/core_main.c src/gulm bmarzins
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=20060914202834.9024.qmail@sourceware.org \
--to=bmarzins@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).