cluster: STABLE3 - cman: Fix cman_tool join again
Christine Caulfield
chrissie at fedoraproject.org
Thu Oct 8 13:51:45 UTC 2009
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=1237d2f7e65c27f791ff0a8e47569bff36a5c667
Commit: 1237d2f7e65c27f791ff0a8e47569bff36a5c667
Parent: 445f8037fcd47df27995be65cb85d0232f216584
Author: Christine Caulfield <ccaulfie at redhat.com>
AuthorDate: Thu Oct 8 14:50:47 2009 +0100
Committer: Christine Caulfield <ccaulfie at redhat.com>
CommitterDate: Thu Oct 8 14:50:47 2009 +0100
cman: Fix cman_tool join again
This must be nearly right now, surely.
This patch fixes some odd startup races where cman_tool could report
that corosync had failed to start, when it had started perfectly
well.
Signed-off-by: Christine Caulfield <ccaulfie at redhat.com>
---
cman/cman_tool/join.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/cman/cman_tool/join.c b/cman/cman_tool/join.c
index fa3efb7..8e85a58 100644
--- a/cman/cman_tool/join.c
+++ b/cman/cman_tool/join.c
@@ -96,7 +96,7 @@ static int check_corosync_status(pid_t pid)
return 0;
}
- if ((status == 0 || status == pid) && pidstatus != 0) {
+ if (status == pid && pidstatus != 0) {
if (WIFEXITED(pidstatus))
fprintf(stderr, "corosync died: %s\n", corosync_exit_reason(WEXITSTATUS(pidstatus)));
if (WIFSIGNALED(pidstatus))
@@ -234,7 +234,7 @@ int join(commandline_t *comline, char *main_envp[])
be_daemon();
sprintf(scratch, "FORKED: %d\n", getpid());
- err = write(p[1], scratch, strlen(scratch));
+ err = write(p[1], scratch, strlen(scratch)+1);
execve(COROSYNCBIN, argv, envp);
@@ -288,6 +288,7 @@ int join(commandline_t *comline, char *main_envp[])
if (sscanf(messageptr, "SUCCESS: %d", &corosync_pid) == 1) {
if (comline->verbose & DEBUG_STARTUP_ONLY)
fprintf(stderr, "corosync running, process ID is %d\n", corosync_pid);
+ status = 0;
break;
}
else if (messageptr) {
@@ -301,6 +302,8 @@ int join(commandline_t *comline, char *main_envp[])
}
else { /* Error or EOF - check the child status */
status = check_corosync_status(corosync_pid);
+ if (status == 0)
+ break;
}
}
More information about the cluster-commits
mailing list