public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Brassow <jbrassow@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: cluster: RHEL5 - clogd: Fix bug 484968 - segfault in clogd
Date: Tue, 10 Feb 2009 22:13:00 -0000	[thread overview]
Message-ID: <20090210221335.DE20B12011A@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=c9d6207f212f900f66c9c6990462bae328ede121
Commit:        c9d6207f212f900f66c9c6990462bae328ede121
Parent:        337f12b719cb5dfb279317d2d111954c5c5c0416
Author:        Jonathan Brassow <jbrassow@redhat.com>
AuthorDate:    Tue Feb 10 16:11:43 2009 -0600
Committer:     Jonathan Brassow <jbrassow@redhat.com>
CommitterDate: Tue Feb 10 16:11:43 2009 -0600

clogd: Fix bug 484968 - segfault in clogd

If a mirror was started and then suspended very shortly after,
the list of pent-up requests waiting for a checkpoint would be freed.
If one of those requests was POSTSUSPEND, it would be processed and
would also try to free the list of pent-up requests.  Since this action
was nested, the outer function would segfault because the list it was
processing was free out from under it.

Frequency of this is rare.
---
 cmirror/src/cluster.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/cmirror/src/cluster.c b/cmirror/src/cluster.c
index d4ee730..e43edbe 100644
--- a/cmirror/src/cluster.c
+++ b/cmirror/src/cluster.c
@@ -1444,6 +1444,7 @@ static void abort_startup(struct clog_cpg *del)
 static int _destroy_cluster_cpg(struct clog_cpg *del)
 {
 	int r;
+	int state;
 	
 	LOG_COND(log_resend_requests, "[%s] I am leaving.2.....",
 		 SHORT_UUID(del->name.value));
@@ -1455,10 +1456,17 @@ static int _destroy_cluster_cpg(struct clog_cpg *del)
 	 */
 	do_checkpoints(del);
 
+	state = del->state;
+
 	del->cpg_state = INVALID;
 	del->state = LEAVING;
 
-	if (!list_empty(&del->startup_list))
+	/*
+	 * If the state is VALID, we might be processing the
+	 * startup list.  If so, we certainly don't want to
+	 * clear the startup_list here by calling abort_startup
+	 */
+	if (!list_empty(&del->startup_list) && (state != VALID))
 		abort_startup(del);
 
 	r = cpg_leave(del->handle, &del->name);


                 reply	other threads:[~2009-02-10 22:13 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=20090210221335.DE20B12011A@lists.fedorahosted.org \
    --to=jbrassow@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: link
Be 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).