From mboxrd@z Thu Jan 1 00:00:00 1970 From: pcaulfield@sourceware.org Date: 7 Dec 2006 09:54:15 -0000 Subject: [Cluster-devel] cluster/cman/cman_tool join.c Message-ID: <20061207095415.12237.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Changes by: pcaulfield at sourceware.org 2006-12-07 09:54:15 Modified files: cman/cman_tool : join.c Log message: Fix minor bug where cman_tool join didn't spot that aisexec had started correctly or crashed. This means we can up the timer for allowing aisexec to start with no ill effects. see bz#218688 Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/cman_tool/join.c.diff?cvsroot=cluster&r1=1.47&r2=1.48 --- cluster/cman/cman_tool/join.c 2006/08/11 12:34:18 1.47 +++ cluster/cman/cman_tool/join.c 2006/12/07 09:54:14 1.48 @@ -11,6 +11,7 @@ ******************************************************************************* ******************************************************************************/ +#include #include #include #include @@ -148,6 +149,7 @@ /* Give the daemon a chance to start up, and monitor the pipe FD for messages */ i = 0; + close(p[1]); do { fd_set fds; struct timeval tv={1, 0}; @@ -158,13 +160,6 @@ FD_SET(p[0], &fds); status = select(p[0]+1, &fds, NULL, NULL, &tv); - if (status == 0) { - h = cman_admin_init(NULL); - if (!h && comline->verbose) - { - fprintf(stderr, "waiting for aisexec to start\n"); - } - } /* Did we get an error? */ if (status == 1) { @@ -172,9 +167,22 @@ fprintf(stderr, "cman not started: %s\n", message); break; } - + else { + int pidstatus; + if (waitpid(aisexec_pid, &pidstatus, WNOHANG) == 0) + fprintf(stderr, "cman died with status: %d\n", WEXITSTATUS(pidstatus)); + else + status = 0; /* Try to connect */ + } + } + if (status == 0) { + h = cman_admin_init(NULL); + if (!h && comline->verbose) + { + fprintf(stderr, "waiting for aisexec to start\n"); + } } - } while (!h && ++i < 20); + } while (!h && ++i < 100); if (!h) die("aisexec daemon didn't start");