cluster: RHEL58 - resource-agents: orainstance.sh: Fix temporary variables
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 7106e41ced6b5d82a50cbca9e5c0e73ac99b1638
Parent: 5a67bbf795db62d9b20179f96b0ad17066cae4cd
Author: Shane Bradley <sbradley(a)redhat.com>
AuthorDate: Tue Oct 25 17:52:26 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Oct 25 18:02:37 2011 -0400
resource-agents: orainstance.sh: Fix temporary variables
This patch helps avoid log file name collisions when
multiple instances are started or stopped at the same
time.
Resolves: rhbz#744283
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/resources/orainstance.sh | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/rgmanager/src/resources/orainstance.sh b/rgmanager/src/resources/orainstance.sh
index ca80f32..6f2ff15 100755
--- a/rgmanager/src/resources/orainstance.sh
+++ b/rgmanager/src/resources/orainstance.sh
@@ -81,7 +81,7 @@ start_db() {
declare -i rv
tmpfile=/tmp/$SCRIPT-start.$$
- logfile=/tmp/$SCRIPT-start.log
+ logfile=/tmp/$SCRIPT-start.log.$$
# Set up our sqlplus script. Basically, we're trying to
# capture output in the hopes that it's useful in the case
@@ -127,7 +127,7 @@ stop_db() {
declare -i rv
tmpfile=/tmp/$SCRIPT-stop.$$
- logfile=/tmp/$SCRIPT-stop.log
+ logfile=/tmp/$SCRIPT-stop.log.$$
ora_procname="ora_${DB_PROCNAMES}_${ORACLE_SID}"
status $ora_procname
12 years, 6 months
cluster: RHEL58 - rgmanager: Fix dependency restart bug in CP mode
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 5a67bbf795db62d9b20179f96b0ad17066cae4cd
Parent: 98c9f869ffb041341b835d19da3845b6165af7d2
Author: Adam Drew <adrew(a)redhat.com>
AuthorDate: Fri Oct 7 12:31:16 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Oct 25 18:02:33 2011 -0400
rgmanager: Fix dependency restart bug in CP mode
If we:
- had central_processing mode enabled,
- had a service with 'depend' set on another
service,
- we attempted to restart the service with the
dependency, and
- the dependency was missing
rgmanager would leave the state in 'recovering'
This is the corrected patch from Adam.
Resolves: rhbz#743442
Signed-off-by: Adam Drew <adrew(a)redhat.com>
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/resources/default_event_script.sl | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/rgmanager/src/resources/default_event_script.sl b/rgmanager/src/resources/default_event_script.sl
index d567465..cdde066 100644
--- a/rgmanager/src/resources/default_event_script.sl
+++ b/rgmanager/src/resources/default_event_script.sl
@@ -158,6 +158,7 @@ define move_or_start(service, node_list)
(,,, owner, state) = service_status(depends);
if (owner < 0) {
debug(service, " is not runnable; dependency not met");
+ ()=service_stop(service);
return ERR_DEPEND;
}
}
12 years, 6 months
cluster: RHEL58 - rgmanager: Fix dependency restart bug
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 98c9f869ffb041341b835d19da3845b6165af7d2
Parent: 886d6504464e4af32d02da0d64fd09a040b65fe4
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Fri Oct 7 12:31:16 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Oct 25 17:47:44 2011 -0400
rgmanager: Fix dependency restart bug
If we:
- had a service with 'depend' set on another
service,
- both services were running on the same host,
- that host died, and
- the service which depended on the other service
also had the 'restart' recovery policy,
rgmanager would enter handle_start_req and return
an immediate error - with no further recovery action
performed.
Resolves: rhbz#743442
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/daemons/rg_state.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
index dce28db..c02bfda 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -2131,8 +2131,16 @@ handle_start_req(char *svcName, int req, int *new_owner)
/* Check for dependency. We cannot start unless our
dependency is met */
- if (check_depend_safe(svcName) == 0)
+ if (check_depend_safe(svcName) == 0) {
+ if (req == RG_START_RECOVER) {
+ clulog(LOG_INFO, "Dependency for %s missing "
+ "during recovery; marking as stopped",
+ svcName);
+
+ _svc_stop_finish(svcName, 0, RG_STATE_STOPPED);
+ }
return RG_EDEPEND;
+ }
/*
* This is a 'root' start request. We need to clear out our failure
12 years, 6 months
cluster: RHEL58 - rgmanager: Resolve rare deadlock
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 886d6504464e4af32d02da0d64fd09a040b65fe4
Parent: 141d1d9241b2ad2cd8865d524a6b38dc069fffd3
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Tue Sep 6 15:42:41 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Oct 25 17:47:02 2011 -0400
rgmanager: Resolve rare deadlock
In very rare cases, it was possible to fill up a pipe used for
IPC between threads during reconfiguration, causing a deadlock.
This patch resolves the issue.
Resolves: rhbz#713243
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/daemons/groups.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/rgmanager/src/daemons/groups.c b/rgmanager/src/daemons/groups.c
index b546421..1e93e03 100644
--- a/rgmanager/src/daemons/groups.c
+++ b/rgmanager/src/daemons/groups.c
@@ -1737,8 +1737,6 @@ init_resource_groups(int reconfigure, int do_init, int new_config_version)
free(val);
}
- /* Wait for any pending requests */
- rg_wait_threads();
/* Block operations that would break during configuration
changes */
rg_clear_initialized(FL_CONFIG);
12 years, 6 months
cluster: STABLE31 - rgmanager: Fix dependency restart bug in CP mode
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 5ce78b0a1a1c5851524497b305a568e52043cf09
Parent: a95fcca7ecd070c0fef1b85d3158e728b04c3398
Author: Adam Drew <adrew(a)redhat.com>
AuthorDate: Fri Oct 7 12:31:16 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Oct 25 17:31:15 2011 -0400
rgmanager: Fix dependency restart bug in CP mode
If we:
- had central_processing mode enabled,
- had a service with 'depend' set on another
service,
- we attempted to restart the service with the
dependency, and
- the dependency was missing
rgmanager would leave the state in 'recovering'
This is the corrected patch from Adam.
Resolves: rhbz#743442
Signed-off-by: Adam Drew <adrew(a)redhat.com>
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/resources/default_event_script.sl | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/rgmanager/src/resources/default_event_script.sl b/rgmanager/src/resources/default_event_script.sl
index 759215c..4c5ca0e 100644
--- a/rgmanager/src/resources/default_event_script.sl
+++ b/rgmanager/src/resources/default_event_script.sl
@@ -178,6 +178,7 @@ define move_or_start(service, node_list)
(,,, owner, state) = service_status(depends);
if (owner < 0) {
debug(service, " is not runnable; dependency not met");
+ ()=service_stop(service);
return ERR_DEPEND;
}
}
12 years, 6 months
cluster: STABLE31 - Revert "rgmanager: Fix dependency restart bug in CP mode"
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: a95fcca7ecd070c0fef1b85d3158e728b04c3398
Parent: ff5a198a0712fa91efdc0912c3db5ae30a87f7f8
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Tue Oct 25 17:27:00 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Oct 25 17:27:00 2011 -0400
Revert "rgmanager: Fix dependency restart bug in CP mode"
This reverts commit c751d1894640b096808d2f13e331bee4c536f96a.
This patch was not the one intended to be pushed.
---
rgmanager/src/resources/default_event_script.sl | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/rgmanager/src/resources/default_event_script.sl b/rgmanager/src/resources/default_event_script.sl
index 57f65e9..759215c 100644
--- a/rgmanager/src/resources/default_event_script.sl
+++ b/rgmanager/src/resources/default_event_script.sl
@@ -178,9 +178,6 @@ define move_or_start(service, node_list)
(,,, owner, state) = service_status(depends);
if (owner < 0) {
debug(service, " is not runnable; dependency not met");
- if (state == "recovering") {
- service_stop(service);
- }
return ERR_DEPEND;
}
}
12 years, 6 months
cluster: RHEL6 - rgmanager: Block signals when dealing with dbus
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 17bacf59aea4f2d021ba8127f71e9d840703b692
Parent: a8cca57d6dd0026ac49c87b0dd9e9906cc7872cb
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Tue Oct 18 19:05:59 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Wed Oct 19 09:06:11 2011 -0400
rgmanager: Block signals when dealing with dbus
DBus calls seem to not retry in the event of signals; it
appears that occasionally this causes a double unref or
a segfault. So, block signals when dealing with DBus in
order to prevent rgmanager from crashing.
Resolves: rhbz#741607
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-By: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
rgmanager/src/daemons/update-dbus.c | 62 +++++++++++++++++++++++++++-------
1 files changed, 49 insertions(+), 13 deletions(-)
diff --git a/rgmanager/src/daemons/update-dbus.c b/rgmanager/src/daemons/update-dbus.c
index 29ecaca..e706746 100644
--- a/rgmanager/src/daemons/update-dbus.c
+++ b/rgmanager/src/daemons/update-dbus.c
@@ -12,6 +12,7 @@
#include <dbus/dbus.h>
#include <liblogthread.h>
#include <members.h>
+#include <signal.h>
#define DBUS_RGM_NAME "com.redhat.cluster.rgmanager"
@@ -28,6 +29,28 @@ static pthread_t th = 0;
/* Set this to the desired value prior to calling rgm_dbus_init() */
int rgm_dbus_notify = RGM_DBUS_DEFAULT;
+/*
+ * block the world when entering dbus critical sections so that
+ * if we get a signal while in dbus critical (exclusive of crash
+ * signals), we ignore it
+ */
+#define DBUS_ENTRY(set, old) \
+do { \
+ pthread_mutex_lock(&mu); \
+ sigfillset(&set); \
+ sigdelset(&set, SIGILL); \
+ sigdelset(&set, SIGSEGV); \
+ sigdelset(&set, SIGABRT); \
+ sigdelset(&set, SIGBUS); \
+ sigprocmask(SIG_SETMASK, &set, &old); \
+} while(0)
+
+#define DBUS_EXIT(old) \
+do { \
+ sigprocmask(SIG_SETMASK, &old, NULL); \
+ pthread_mutex_unlock(&mu); \
+} while(0)
+
int
rgm_dbus_init(void)
@@ -35,13 +58,14 @@ rgm_dbus_init(void)
{
DBusConnection *dbc = NULL;
DBusError err;
+ sigset_t set, old;
if (!rgm_dbus_notify)
return 0;
- pthread_mutex_lock(&mu);
+ DBUS_ENTRY(set, old);
if (db) {
- pthread_mutex_unlock(&mu);
+ DBUS_EXIT(old);
return 0;
}
@@ -53,7 +77,7 @@ rgm_dbus_init(void)
"DBus Failed to initialize: dbus_bus_get: %s\n",
err.message);
dbus_error_free(&err);
- pthread_mutex_unlock(&mu);
+ DBUS_EXIT(old);
return -1;
}
@@ -63,7 +87,7 @@ rgm_dbus_init(void)
pthread_create(&th, NULL, _dbus_auto_flush, NULL);
- pthread_mutex_unlock(&mu);
+ DBUS_EXIT(old);
logt_print(LOG_DEBUG, "DBus Notifications Initialized\n");
return 0;
}
@@ -111,10 +135,11 @@ rgm_dbus_release(void)
#ifdef DBUS
{
int ret;
+ sigset_t set, old;
- pthread_mutex_lock(&mu);
+ DBUS_ENTRY(set, old);
ret = _rgm_dbus_release();
- pthread_mutex_unlock(&mu);
+ DBUS_EXIT(old);
return ret;
}
#else
@@ -131,6 +156,15 @@ rgm_dbus_release(void)
static void *
_dbus_auto_flush(void *arg)
{
+ sigset_t set;
+
+ sigfillset(&set);
+ sigdelset(&set, SIGILL);
+ sigdelset(&set, SIGSEGV);
+ sigdelset(&set, SIGABRT);
+ sigdelset(&set, SIGBUS);
+ sigprocmask(SIG_SETMASK, &set, NULL);
+
/* DBus connection functions are thread safe */
while (dbus_connection_read_write(db, 500)) {
if (!th)
@@ -151,8 +185,9 @@ _rgm_dbus_notify(const char *svcname,
{
DBusMessage *msg = NULL;
int ret = 0;
+ sigset_t set, old;
- pthread_mutex_lock(&mu);
+ DBUS_ENTRY(set, old);
if (!db) {
goto out_unlock;
@@ -197,10 +232,10 @@ _rgm_dbus_notify(const char *svcname,
ret = 0;
out_unlock:
- pthread_mutex_unlock(&mu);
+ DBUS_EXIT(old);
if (msg)
dbus_message_unref(msg);
-out_free:
+
return ret;
}
@@ -216,6 +251,7 @@ rgm_dbus_update(char *key, uint64_t view, void *data, uint32_t size)
cluster_member_list_t *m = NULL;
const char *owner;
const char *last;
+ sigset_t set, old;
int ret = 0;
if (!rgm_dbus_notify)
@@ -225,18 +261,18 @@ rgm_dbus_update(char *key, uint64_t view, void *data, uint32_t size)
if (size != (sizeof(*st)))
goto out_free;
- pthread_mutex_lock(&mu);
+ DBUS_ENTRY(set, old);
if (!db) {
- pthread_mutex_unlock(&mu);
+ DBUS_EXIT(old);
goto out_free;
}
if (!th) {
/* Dispatch thread died. */
_rgm_dbus_release();
- pthread_mutex_unlock(&mu);
+ DBUS_EXIT(old);
goto out_free;
}
- pthread_mutex_unlock(&mu);
+ DBUS_EXIT(old);
st = (rg_state_t *)data;
swab_rg_state_t(st);
12 years, 6 months
cluster: RHEL6 - rgmanager: Clean up DBus concurrency
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: a8cca57d6dd0026ac49c87b0dd9e9906cc7872cb
Parent: 0fac6d9e86424411289bf7926bc6f8c6805082e9
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Wed Sep 28 10:56:54 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Wed Oct 19 09:05:42 2011 -0400
rgmanager: Clean up DBus concurrency
This centralizes creation/deletion of the DBus
dispatch thread.
Resolves: rhbz#741607
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-By: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
rgmanager/src/daemons/update-dbus.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/rgmanager/src/daemons/update-dbus.c b/rgmanager/src/daemons/update-dbus.c
index b45113c..29ecaca 100644
--- a/rgmanager/src/daemons/update-dbus.c
+++ b/rgmanager/src/daemons/update-dbus.c
@@ -18,6 +18,8 @@
#define DBUS_RGM_IFACE "com.redhat.cluster.rgmanager"
#define DBUS_RGM_PATH "/com/redhat/cluster/rgmanager"
+static void * _dbus_auto_flush(void *arg);
+
static DBusConnection *db = NULL;
static pthread_mutex_t mu = PTHREAD_MUTEX_INITIALIZER;
static pthread_t th = 0;
@@ -58,6 +60,9 @@ rgm_dbus_init(void)
dbus_connection_set_exit_on_disconnect(dbc, FALSE);
db = dbc;
+
+ pthread_create(&th, NULL, _dbus_auto_flush, NULL);
+
pthread_mutex_unlock(&mu);
logt_print(LOG_DEBUG, "DBus Notifications Initialized\n");
return 0;
@@ -169,8 +174,7 @@ _rgm_dbus_notify(const char *svcname,
}
if (!th) {
- /* start auto-flush thread if needed */
- pthread_create(&th, NULL, _dbus_auto_flush, NULL);
+ goto out_unlock;
}
if (!(msg = dbus_message_new_signal(DBUS_RGM_PATH,
@@ -226,6 +230,12 @@ rgm_dbus_update(char *key, uint64_t view, void *data, uint32_t size)
pthread_mutex_unlock(&mu);
goto out_free;
}
+ if (!th) {
+ /* Dispatch thread died. */
+ _rgm_dbus_release();
+ pthread_mutex_unlock(&mu);
+ goto out_free;
+ }
pthread_mutex_unlock(&mu);
st = (rg_state_t *)data;
12 years, 6 months
cluster: STABLE31 - rgmanager: Block signals when dealing with dbus
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: ff5a198a0712fa91efdc0912c3db5ae30a87f7f8
Parent: 4ab2a3a55eb164a65f361b7d9bbbf186e88cf247
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Tue Oct 18 19:05:59 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Oct 18 23:24:58 2011 -0400
rgmanager: Block signals when dealing with dbus
DBus calls seem to not retry in the event of signals; it
appears that occasionally this causes a double unref or
a segfault. So, block signals when dealing with DBus in
order to prevent rgmanager from crashing.
Resolves: rhbz#741607
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/daemons/update-dbus.c | 62 +++++++++++++++++++++++++++-------
1 files changed, 49 insertions(+), 13 deletions(-)
diff --git a/rgmanager/src/daemons/update-dbus.c b/rgmanager/src/daemons/update-dbus.c
index 29ecaca..e706746 100644
--- a/rgmanager/src/daemons/update-dbus.c
+++ b/rgmanager/src/daemons/update-dbus.c
@@ -12,6 +12,7 @@
#include <dbus/dbus.h>
#include <liblogthread.h>
#include <members.h>
+#include <signal.h>
#define DBUS_RGM_NAME "com.redhat.cluster.rgmanager"
@@ -28,6 +29,28 @@ static pthread_t th = 0;
/* Set this to the desired value prior to calling rgm_dbus_init() */
int rgm_dbus_notify = RGM_DBUS_DEFAULT;
+/*
+ * block the world when entering dbus critical sections so that
+ * if we get a signal while in dbus critical (exclusive of crash
+ * signals), we ignore it
+ */
+#define DBUS_ENTRY(set, old) \
+do { \
+ pthread_mutex_lock(&mu); \
+ sigfillset(&set); \
+ sigdelset(&set, SIGILL); \
+ sigdelset(&set, SIGSEGV); \
+ sigdelset(&set, SIGABRT); \
+ sigdelset(&set, SIGBUS); \
+ sigprocmask(SIG_SETMASK, &set, &old); \
+} while(0)
+
+#define DBUS_EXIT(old) \
+do { \
+ sigprocmask(SIG_SETMASK, &old, NULL); \
+ pthread_mutex_unlock(&mu); \
+} while(0)
+
int
rgm_dbus_init(void)
@@ -35,13 +58,14 @@ rgm_dbus_init(void)
{
DBusConnection *dbc = NULL;
DBusError err;
+ sigset_t set, old;
if (!rgm_dbus_notify)
return 0;
- pthread_mutex_lock(&mu);
+ DBUS_ENTRY(set, old);
if (db) {
- pthread_mutex_unlock(&mu);
+ DBUS_EXIT(old);
return 0;
}
@@ -53,7 +77,7 @@ rgm_dbus_init(void)
"DBus Failed to initialize: dbus_bus_get: %s\n",
err.message);
dbus_error_free(&err);
- pthread_mutex_unlock(&mu);
+ DBUS_EXIT(old);
return -1;
}
@@ -63,7 +87,7 @@ rgm_dbus_init(void)
pthread_create(&th, NULL, _dbus_auto_flush, NULL);
- pthread_mutex_unlock(&mu);
+ DBUS_EXIT(old);
logt_print(LOG_DEBUG, "DBus Notifications Initialized\n");
return 0;
}
@@ -111,10 +135,11 @@ rgm_dbus_release(void)
#ifdef DBUS
{
int ret;
+ sigset_t set, old;
- pthread_mutex_lock(&mu);
+ DBUS_ENTRY(set, old);
ret = _rgm_dbus_release();
- pthread_mutex_unlock(&mu);
+ DBUS_EXIT(old);
return ret;
}
#else
@@ -131,6 +156,15 @@ rgm_dbus_release(void)
static void *
_dbus_auto_flush(void *arg)
{
+ sigset_t set;
+
+ sigfillset(&set);
+ sigdelset(&set, SIGILL);
+ sigdelset(&set, SIGSEGV);
+ sigdelset(&set, SIGABRT);
+ sigdelset(&set, SIGBUS);
+ sigprocmask(SIG_SETMASK, &set, NULL);
+
/* DBus connection functions are thread safe */
while (dbus_connection_read_write(db, 500)) {
if (!th)
@@ -151,8 +185,9 @@ _rgm_dbus_notify(const char *svcname,
{
DBusMessage *msg = NULL;
int ret = 0;
+ sigset_t set, old;
- pthread_mutex_lock(&mu);
+ DBUS_ENTRY(set, old);
if (!db) {
goto out_unlock;
@@ -197,10 +232,10 @@ _rgm_dbus_notify(const char *svcname,
ret = 0;
out_unlock:
- pthread_mutex_unlock(&mu);
+ DBUS_EXIT(old);
if (msg)
dbus_message_unref(msg);
-out_free:
+
return ret;
}
@@ -216,6 +251,7 @@ rgm_dbus_update(char *key, uint64_t view, void *data, uint32_t size)
cluster_member_list_t *m = NULL;
const char *owner;
const char *last;
+ sigset_t set, old;
int ret = 0;
if (!rgm_dbus_notify)
@@ -225,18 +261,18 @@ rgm_dbus_update(char *key, uint64_t view, void *data, uint32_t size)
if (size != (sizeof(*st)))
goto out_free;
- pthread_mutex_lock(&mu);
+ DBUS_ENTRY(set, old);
if (!db) {
- pthread_mutex_unlock(&mu);
+ DBUS_EXIT(old);
goto out_free;
}
if (!th) {
/* Dispatch thread died. */
_rgm_dbus_release();
- pthread_mutex_unlock(&mu);
+ DBUS_EXIT(old);
goto out_free;
}
- pthread_mutex_unlock(&mu);
+ DBUS_EXIT(old);
st = (rg_state_t *)data;
swab_rg_state_t(st);
12 years, 6 months
cluster: STABLE31 - rgmanager: Clean up DBus concurrency
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 4ab2a3a55eb164a65f361b7d9bbbf186e88cf247
Parent: c751d1894640b096808d2f13e331bee4c536f96a
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Wed Sep 28 10:56:54 2011 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Oct 18 23:24:47 2011 -0400
rgmanager: Clean up DBus concurrency
This centralizes creation/deletion of the DBus
dispatch thread.
Resolves: rhbz#741607
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
rgmanager/src/daemons/update-dbus.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/rgmanager/src/daemons/update-dbus.c b/rgmanager/src/daemons/update-dbus.c
index b45113c..29ecaca 100644
--- a/rgmanager/src/daemons/update-dbus.c
+++ b/rgmanager/src/daemons/update-dbus.c
@@ -18,6 +18,8 @@
#define DBUS_RGM_IFACE "com.redhat.cluster.rgmanager"
#define DBUS_RGM_PATH "/com/redhat/cluster/rgmanager"
+static void * _dbus_auto_flush(void *arg);
+
static DBusConnection *db = NULL;
static pthread_mutex_t mu = PTHREAD_MUTEX_INITIALIZER;
static pthread_t th = 0;
@@ -58,6 +60,9 @@ rgm_dbus_init(void)
dbus_connection_set_exit_on_disconnect(dbc, FALSE);
db = dbc;
+
+ pthread_create(&th, NULL, _dbus_auto_flush, NULL);
+
pthread_mutex_unlock(&mu);
logt_print(LOG_DEBUG, "DBus Notifications Initialized\n");
return 0;
@@ -169,8 +174,7 @@ _rgm_dbus_notify(const char *svcname,
}
if (!th) {
- /* start auto-flush thread if needed */
- pthread_create(&th, NULL, _dbus_auto_flush, NULL);
+ goto out_unlock;
}
if (!(msg = dbus_message_new_signal(DBUS_RGM_PATH,
@@ -226,6 +230,12 @@ rgm_dbus_update(char *key, uint64_t view, void *data, uint32_t size)
pthread_mutex_unlock(&mu);
goto out_free;
}
+ if (!th) {
+ /* Dispatch thread died. */
+ _rgm_dbus_release();
+ pthread_mutex_unlock(&mu);
+ goto out_free;
+ }
pthread_mutex_unlock(&mu);
st = (rg_state_t *)data;
12 years, 6 months