Skip to contentSkip to conversation

changeset r1474 of openais in SVN trunk broke some plugins such as cman_tool

Cluster-devel rae l 1 participant 1 message Nov 15, 2007 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

rae l

author
#1 lore raw

---------- Forwarded message ----------
From: Denis Cheng <[email protected]>
Date: Nov 14, 2007 5:06 PM
Subject: changeset r1474 of openais in SVN trunk broke some plugins such as cman_tool
To: [email protected]
Cc: cluster-devel at 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:

exec/main.c +2 -1
Index: trunk/exec/main.c
===================================================================
@@ -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