All of lore.kernel.org
 help / color / mirror / Atom feed
From: lhh@sourceware.org <lhh@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/rgmanager ChangeLog src/clulib/clulog. ...
Date: 5 Oct 2006 17:52:27 -0000	[thread overview]
Message-ID: <20061005175227.26866.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL4
Changes by:	lhh at 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@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@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");



                 reply	other threads:[~2006-10-05 17:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20061005175227.26866.qmail@sourceware.org \
    --to=lhh@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.