[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] cluster/rgmanager ChangeLog src/clulib/clulog. ...



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4
Changes by:	lhh sourceware org	2006-10-05 17:52:27

Modified files:
	rgmanager      : ChangeLog 
	rgmanager/src/clulib: clulog.c 
	rgmanager/src/daemons: main.c 

Log message:
	Fix #207144

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/ChangeLog.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.5.2.22&r2=1.5.2.23
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/clulib/clulog.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.2.2.2&r2=1.2.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/daemons/main.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.9.2.19&r2=1.9.2.20

--- cluster/rgmanager/ChangeLog	2006/09/27 12:22:41	1.5.2.22
+++ cluster/rgmanager/ChangeLog	2006/10/05 17:52:27	1.5.2.23
@@ -1,3 +1,11 @@
+2006-10-05 Lon Hohberger <lhh at redhat.com>
+	* src/clulib/clulog.c: Change stdout/stderr to nonblocking (#207144
+	part 1)
+	* src/daemons/main.c: Give a timeout for a message to be received
+	after msg_accept() so that if we are processing a message from a
+	client which died, we don't wait forever, thereby preventing
+        group updates (#207144 part 2).
+
 2006-09-27 Lon Hohberger <lhh at redhat.com>
 	* src/daemons/rg_state.c: Fix fail->disable state transitions,
 	bugzilla #208011
--- cluster/rgmanager/src/clulib/clulog.c	2005/12/06 18:43:48	1.2.2.2
+++ cluster/rgmanager/src/clulib/clulog.c	2006/10/05 17:52:27	1.2.2.3
@@ -20,7 +20,7 @@
 /** @file
  * Library routines for communicating with the logging daemon.
  *
- *  $Id: clulog.c,v 1.2.2.2 2005/12/06 18:43:48 lhh Exp $
+ *  $Id: clulog.c,v 1.2.2.3 2006/10/05 17:52:27 lhh Exp $
  *
  *  Author: Jeff Moyer <moyer missioncriticallinux com>
  */
@@ -50,7 +50,7 @@
 #include <string.h>
 
 
-static const char *version __attribute__ ((unused)) = "$Revision: 1.2.2.2 $";
+static const char *version __attribute__ ((unused)) = "$Revision: 1.2.2.3 $";
 
 #ifdef DEBUG
 #include <assert.h>
@@ -183,6 +183,14 @@
 clu_log_console(int onoff)
 {
 	int ret = useconsole;
+	int val;
+
+	if (onoff) {
+		val = fcntl(STDERR_FILENO, F_GETFL, 0);
+		fcntl(STDERR_FILENO, F_SETFL, val|O_NONBLOCK);
+		val = fcntl(STDOUT_FILENO, F_GETFL, 0);
+		fcntl(STDOUT_FILENO, F_SETFL, val|O_NONBLOCK);
+	}
 
 	useconsole = !!onoff;
 	return ret;
@@ -204,6 +212,7 @@
 	char         logmsg[MAX_LOGMSG_LEN];	/* message to go to the log */
 	char         printmsg[MAX_LOGMSG_LEN];	/* message to go to stdout */
 	int          syslog_flags = LOG_NDELAY;
+	int	     val;
 
 	pthread_mutex_lock(&log_mutex);
 	if (severity > loglevel) {
@@ -275,9 +284,19 @@
 			  MAX_LOGMSG_LEN - strlen(printmsg), fmt, args);
 		va_end(args);
 
-		fprintf(stdout, "%s", printmsg);
+		if (useconsole && !write_to_cons) {
+			val = fcntl(STDOUT_FILENO, F_GETFL, 0);
+			fcntl(STDOUT_FILENO, F_SETFL, val | O_NONBLOCK);
+		}
+
+		/* Ignore error return code */
+		write(STDOUT_FILENO, printmsg, strlen(printmsg));
+
+		if (useconsole && !write_to_cons)
+			fcntl(STDOUT_FILENO, F_SETFL, val);
 	}
 
+	/* TODO make this non-blocking */
 	syslog(severity, logmsg);
 
 	pthread_mutex_unlock(&log_mutex);
--- cluster/rgmanager/src/daemons/main.c	2006/09/25 20:16:40	1.9.2.19
+++ cluster/rgmanager/src/daemons/main.c	2006/10/05 17:52:27	1.9.2.20
@@ -342,8 +342,18 @@
 	int ret;
 	generic_msg_hdr	msg_hdr;
 	SmMessageSt	msg_sm;
+	fd_set rfds;
+	struct timeval tv = { 0, 500000 };
 
 	/* Peek-a-boo */
+	FD_ZERO(&rfds);
+	FD_SET(fd, &rfds);
+	if (select(fd+1, &rfds, NULL, NULL, &tv) <= 0) {
+		clulog(LOG_WARNING, "Client timeout after new connection.\n");
+		msg_close(fd);
+		return -1;
+	}
+
 	ret = msg_peek(fd, &msg_hdr, sizeof(msg_hdr));
 	if (ret != sizeof (generic_msg_hdr)) {
 		clulog(LOG_ERR, "#37: Error receiving message header\n");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]