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

[Cluster-devel] Re: changeset r1474 of openais in SVN trunk broke some plugins such as cman_tool



---------- Forwarded message ----------
From: Denis Cheng <crquan gmail com>
Date: Nov 14, 2007 5:06 PM
Subject: changeset r1474 of openais in SVN trunk broke some plugins
such as cman_tool
To: openais lists osdl org
Cc: cluster-devel redhat com

I noticed the latest changeset r1474 on
http://svn.osdl.org/openais/trunk/exec/main.c is:

    Patch to close all open files on background run operation.

But as far as I know, some openais plugin such as cman_tool of
redhat-cluster-suite have used a PIPE number in environment as its
InterProcessCommunication,

it's internal processing is:
cman_tool create a pipe with pipe systemcall, and put the write pipe
number in an environment variable CMAN_PIPE, clear its close-on-exec
flag bit, fork a subprocess to exec aisexec, then aisexec will execute
/usr/libexec/lcrso/service_cman.lcrso, this plugin will read
cman_tool's write pipe number from the environment, and then write
something to it.

But after r1474 of openais-trunk, this style of IPC will break:
because CMAN_PIPE number usually a little number, below the
oflimits.rlim_cur, that will be closed while aisexec executing, the
service_cman.lcrso would get a broken pipe.

I tried to install cluster-suite from redhat's CVS HEAD and openais
from openais-trunk, and they run uncorrectly indeed.

I don't know why all filedescriptor below oflimits.rlim_cur should be
closed as said in r1474, if just to daemon a process, my suggestion is
just to close all tty file descriptor, and the patch is here, it could
make cman_tool work well:

Index: trunk/exec/main.c
===================================================================
--- trunk/exec/main.c	(revision 1480)
+++ trunk/exec/main.c	(working copy)
@@ -288,7 +288,8 @@
 	 */
 	getrlimit(RLIMIT_NOFILE, &oflimits);
 	for (lpc = 0; lpc < oflimits.rlim_cur; lpc++) {
-		close(lpc);
+		if (isatty(lpc))
+			close(lpc);
 	}

 	/*

--
Denis Cheng
Linux Application Developer


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