public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: David Teigland <teigland@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: cluster: STABLE3 - groupd: cpg_finalize Date: Fri, 27 Feb 2009 18:49:00 -0000 [thread overview] Message-ID: <20090227184836.35BCB120154@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=5e5e9381f9a10ecc3a5f62eabf9cb4baac6b11d4 Commit: 5e5e9381f9a10ecc3a5f62eabf9cb4baac6b11d4 Parent: 4ca347ec2e9ecb3e418876e60e6db834aa0be668 Author: David Teigland <teigland@redhat.com> AuthorDate: Fri Feb 27 12:45:36 2009 -0600 Committer: David Teigland <teigland@redhat.com> CommitterDate: Fri Feb 27 12:45:36 2009 -0600 groupd: cpg_finalize Call cpg_finalize on all our cpg handles when shutting down. Signed-off-by: David Teigland <teigland@redhat.com> --- group/daemon/cpg.c | 28 ++++++++++++++++++++++++++++ group/daemon/gd_internal.h | 2 ++ group/daemon/main.c | 6 +++++- 3 files changed, 35 insertions(+), 1 deletions(-) diff --git a/group/daemon/cpg.c b/group/daemon/cpg.c index 8c28ce4..43c8ddd 100644 --- a/group/daemon/cpg.c +++ b/group/daemon/cpg.c @@ -898,6 +898,34 @@ int setup_cpg(void) return 0; } +void close_cpg(void) +{ + group_t *g; + cpg_error_t error; + int i = 0; + + if (!groupd_handle) + return; + if (cluster_down) + goto fin; + retry: + error = cpg_leave(groupd_handle, &groupd_name); + if (error == CPG_ERR_TRY_AGAIN) { + sleep(1); + if (!(++i % 10)) + log_print("daemon cpg_leave error retrying"); + goto retry; + } + if (error != CPG_OK) + log_print("daemon cpg_leave error %d", error); + fin: + list_for_each_entry(g, &gd_groups, list) { + if (g->cpg_handle) + cpg_finalize(g->cpg_handle); + } + cpg_finalize(groupd_handle); +} + int do_cpg_join(group_t *g) { cpg_error_t error; diff --git a/group/daemon/gd_internal.h b/group/daemon/gd_internal.h index 1927104..7866ba2 100644 --- a/group/daemon/gd_internal.h +++ b/group/daemon/gd_internal.h @@ -36,6 +36,7 @@ extern int daemon_debug_opt; extern int daemon_debug_verbose; extern int daemon_quit; +extern int cluster_down; extern int cman_quorate; extern int our_nodeid; extern char *our_name; @@ -296,6 +297,7 @@ int kill_cman(int nodeid); /* cpg.c */ int setup_cpg(void); +void close_cpg(void); int do_cpg_join(group_t *g); int do_cpg_leave(group_t *g); int send_message(group_t *g, void *buf, int len); diff --git a/group/daemon/main.c b/group/daemon/main.c index 5b07505..b98b02a 100644 --- a/group/daemon/main.c +++ b/group/daemon/main.c @@ -734,8 +734,10 @@ static int setup_listener(char *sock_path) void cluster_dead(int ci) { - log_print("cluster is down, exiting"); + if (!cluster_down) + log_print("cluster is down, exiting"); daemon_quit = 1; + cluster_down = 1; } #define min(x, y) ({ \ @@ -828,6 +830,7 @@ static void loop(void) } } out: + close_cpg(); close_ccs(); close_cman(); @@ -1058,6 +1061,7 @@ void daemon_dump_save(void) int daemon_debug_opt; int daemon_debug_verbose; int daemon_quit; +int cluster_down; int cman_quorate; int our_nodeid; char *our_name;
reply other threads:[~2009-02-27 18:49 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=20090227184836.35BCB120154@lists.fedorahosted.org \ --to=teigland@fedoraproject.org \ --cc=cluster-cvs-relay@redhat.com \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).