cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Lon Hohberger <lhh@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 4/5] rgmanager: minor dbus cleanups
Date: Wed,  2 Feb 2011 19:18:49 -0500	[thread overview]
Message-ID: <1296692330-28319-4-git-send-email-lhh@redhat.com> (raw)
In-Reply-To: <1296692330-28319-1-git-send-email-lhh@redhat.com>

Clean cherry-pick in to RHEL6 branch

Resolves: rhbz#657756

Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
 rgmanager/src/daemons/update-dbus.c |   31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/rgmanager/src/daemons/update-dbus.c b/rgmanager/src/daemons/update-dbus.c
index c9bbf40..f465d1d 100644
--- a/rgmanager/src/daemons/update-dbus.c
+++ b/rgmanager/src/daemons/update-dbus.c
@@ -47,7 +47,7 @@ rgm_dbus_init(void)
 
 	dbc = dbus_bus_get_private(DBUS_BUS_SYSTEM, &err);
 	if (!dbc) {
-		logt_print(LOG_ERR,
+		logt_print(LOG_DEBUG,
 			   "DBus Failed to initialize: dbus_bus_get: %s\n",
 			   err.message);
 		dbus_error_free(&err);
@@ -72,7 +72,7 @@ rgm_dbus_init(void)
 
 #ifdef DBUS
 static int
-_rgm_dbus_release(int err)
+_rgm_dbus_release(void)
 {
 	pthread_t t;
 
@@ -83,7 +83,7 @@ _rgm_dbus_release(int err)
 	 * to wake up, so just have it poll XXX */
 
 	/* if the thread left because the dbus connection died,
-	   this block is avoided since the thread exits */
+	   this block is avoided */
 	if (th) {
 		t = th;
 		th = 0;
@@ -94,15 +94,13 @@ _rgm_dbus_release(int err)
 	dbus_connection_unref(db);
 	db = NULL;
 
-	if (err)
-		logt_print(LOG_ERR, "DBus Connection Lost\n");
-	else
-		logt_print(LOG_DEBUG, "DBus Released\n");
+	logt_print(LOG_DEBUG, "DBus Released\n");
 	return 0;
 }
 #endif
 
 
+/* Clean shutdown (e.g. when exiting */
 int
 rgm_dbus_release(void)
 #ifdef DBUS
@@ -110,7 +108,7 @@ rgm_dbus_release(void)
 	int ret;
 
 	pthread_mutex_lock(&mu);
-	ret = _rgm_dbus_release(0);
+	ret = _rgm_dbus_release();
 	pthread_mutex_unlock(&mu);
 	return ret;
 }
@@ -122,6 +120,9 @@ rgm_dbus_release(void)
 
 
 #ifdef DBUS
+/* Auto-flush thread.  Since sending only guarantees queueing,
+ * we need this thread to push things out over dbus in the
+ * background */
 static void *
 _dbus_auto_flush(void *arg)
 {
@@ -154,8 +155,15 @@ _rgm_dbus_notify(const char *svcname,
 
 	pthread_mutex_lock(&mu);
 
+	/* Check to ensure the connection is still valid. If it
+	 * isn't, clean up and shut down the dbus connection.
+	 *
+	 * The main rgmanager thread will periodically try to
+	 * reinitialize the dbus notification subsystem unless
+	 * the administrator ran rgmanager with the -D command
+	 * line option.
+	 */
 	if (dbus_connection_get_is_connected(db) != TRUE) {
-		_rgm_dbus_release(1);
 		goto out_unlock;
 	}
 
@@ -192,6 +200,9 @@ out_free:
 }
 
 
+/*
+ * view-formation callback function
+ */
 int32_t
 rgm_dbus_update(char *key, uint64_t view, void *data, uint32_t size)
 {
@@ -242,7 +253,7 @@ rgm_dbus_update(char *key, uint64_t view, void *data, uint32_t size)
 
 	if (ret < 0) {
 		logt_print(LOG_ERR, "Error sending update for %s; "
-			   "notifications disabled\n", key);
+			   "DBus notifications disabled\n", key);
 		rgm_dbus_release();
 	}
 
-- 
1.7.2.3



  parent reply	other threads:[~2011-02-03  0:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-03  0:18 [Cluster-devel] [PATCH 1/5] rgmanager: DBus notifications for service state changes Lon Hohberger
2011-02-03  0:18 ` [Cluster-devel] [PATCH 2/5] rgmanager: Clean up dbus notifications Lon Hohberger
2011-02-03  0:31   ` Lon Hohberger
2011-02-03  0:18 ` [Cluster-devel] [PATCH 3/5] rgmanager: Retry dbus if we get disconnected Lon Hohberger
2011-02-03  0:18 ` Lon Hohberger [this message]
2011-02-03  0:18 ` [Cluster-devel] [PATCH 5/5] rgmanager: Match fenced's option to disable DBus Lon Hohberger

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=1296692330-28319-4-git-send-email-lhh@redhat.com \
    --to=lhh@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 NNTP newsgroup(s).