cluster/gulm Makefile src/core_main.c src/gulm ...
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
gulm/Attic/Makefile +2 -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 $@ $^
gulm/src/Attic/core_main.c +12 -0
@@ -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 ();
gulm/src/Attic/gulm_defines.h +1 -32
@@ -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]; \
gulm/src/Attic/lock_main.c +1 -0
@@ -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.
gulm/src/Attic/ltpx_main.c +1 -0
@@ -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 ();
gulm/src/Attic/main_main.c +18 -0
@@ -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 ();