All of lore.kernel.org
 help / color / mirror / Atom feed
From: jbrassow@sourceware.org <jbrassow@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] cluster/cmirror-kernel/src dm-cmirror-client.c
Date: 7 Jul 2006 17:09:56 -0000	[thread overview]
Message-ID: <20060707170956.32209.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	STABLE
Changes by:	jbrassow at sourceware.org	2006-07-07 17:09:54

Modified files:
	cmirror-kernel/src: dm-cmirror-client.c 

Log message:
	- If a cluster mirror was removed, and a new one created fast enough, the
	processes could overlap such that the creation would fail to register
	with cman because the remove hadn't unregistered yet (-EEXIST)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror-kernel/src/dm-cmirror-client.c.diff?cvsroot=cluster&only_with_tag=STABLE&r1=1.1.4.3&r2=1.1.4.4

--- cluster/cmirror-kernel/src/Attic/dm-cmirror-client.c	2006/06/29 19:49:32	1.1.4.3
+++ cluster/cmirror-kernel/src/Attic/dm-cmirror-client.c	2006/07/07 17:09:54	1.1.4.4
@@ -1222,26 +1222,31 @@
 };
 
 static int mirror_set_count = 0; /* used to prevent multiple cluster [dis]connects */
+static DECLARE_MUTEX(cmirror_register_lock);
 
 static int cluster_connect(void)
 {
-	int r;
+	int r = 0;
 
-	if (mirror_set_count++)
-		return 0;
+	down(&cmirror_register_lock);
+
+	if (mirror_set_count++) {
+		up(&cmirror_register_lock);
+		goto out;
+	}
 
 	r = kcl_register_service("clustered_log", 13, SERVICE_LEVEL_GDLM, &clog_ops,
 				 1, NULL, &local_id);
 	if (r) {
-		DMWARN("Couldn't register clustered_log service");
-		return r;
+		DMWARN("Couldn't register clustered_log service.  Reason: %d", r);
+		goto out;
 	}
 
 	r = start_server();
 	if(r){
 		DMWARN("Unable to start clustered log server daemon");
 		kcl_unregister_service(local_id);
-		return r;
+		goto out;
 	}
 
 	r = kcl_join_service(local_id);
@@ -1252,13 +1257,19 @@
 		kcl_unregister_service(local_id);
 	}
 
+out:
+	up(&cmirror_register_lock);
 	return r;
 }
 
 static int cluster_disconnect(void)
 {
-	if (--mirror_set_count)
+	down(&cmirror_register_lock);
+
+	if (--mirror_set_count) {
+		up(&cmirror_register_lock);
 		return 0;
+	}
 
 	/* By setting 'shutting_down', the server will not be suspended **
 	** when a stop is received */
@@ -1267,6 +1278,7 @@
 	stop_server();
 	kcl_unregister_service(local_id);
 
+	up(&cmirror_register_lock);
 	return 0;
 }
 



             reply	other threads:[~2006-07-07 17:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-07 17:09 jbrassow [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-08-23 16:51 [Cluster-devel] cluster/cmirror-kernel/src dm-cmirror-client.c jbrassow
2007-05-09 21:44 jbrassow
2007-03-02 22:31 jbrassow
2006-12-05 17:49 jbrassow
2006-12-05 15:08 jbrassow
2006-12-05  3:13 jbrassow
2006-11-27 23:15 jbrassow
2006-11-27 22:36 jbrassow
2006-11-07 20:48 jbrassow
2006-10-24 21:04 jbrassow
2006-09-08 15:54 jbrassow
2006-09-08 15:52 jbrassow
2006-07-07 17:12 jbrassow
2006-07-07 17:08 jbrassow
2006-06-15 17:53 jbrassow
2006-06-15 17:44 jbrassow

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=20060707170956.32209.qmail@sourceware.org \
    --to=jbrassow@sourceware.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.