cluster: STABLE31 - rgmanager: Fix reference count handling

Lon Hohberger lon at fedoraproject.org
Tue Apr 26 15:23:45 UTC 2011


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=4784df4a5d9e4c606c159f48d9ea4dddc727cce4
Commit:        4784df4a5d9e4c606c159f48d9ea4dddc727cce4
Parent:        079f56ecb56b0d53b44b1871fa8937c22981fc1e
Author:        Lon Hohberger <lhh at redhat.com>
AuthorDate:    Tue Apr 26 10:54:48 2011 -0400
Committer:     Lon Hohberger <lhh at redhat.com>
CommitterDate: Tue Apr 26 11:18:14 2011 -0400

rgmanager: Fix reference count handling

rgmanager feeds reference counts to resource-agents so they can track
when to actually clean up (i.e. when there are no other references).
A problem was found where rgmanager was incorrectly presenting a higher
reference count than expected while stopping, preventing multi-instance
resources (specifically clusterfs.sh) from cleaning up.

Resolves: rhbz#692771

Signed-off-by: Lon Hohberger <lhh at redhat.com>
---
 rgmanager/src/daemons/restree.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/rgmanager/src/daemons/restree.c b/rgmanager/src/daemons/restree.c
index 9652c6e..3892ab9 100644
--- a/rgmanager/src/daemons/restree.c
+++ b/rgmanager/src/daemons/restree.c
@@ -330,6 +330,7 @@ res_exec(resource_node_t *node, int op, const char *arg, int depth)
 	int childpid, pid;
 	int ret = 0;
 	int act_index;
+	int inc = node->rn_resource->r_incarnations;
 	time_t sleeptime = 0, timeout = 0;
 	char **env = NULL;
 	resource_t *res = node->rn_resource;
@@ -353,8 +354,15 @@ res_exec(resource_node_t *node, int op, const char *arg, int depth)
 	if (!(node->rn_flags & RF_ENFORCE_TIMEOUTS))
 		timeout = node->rn_actions[act_index].ra_timeout;
 
+	/* rgmanager ref counts are designed to track *other* incarnations
+	   on the host.  So, if we're started/failed, the RA should not count
+	   this incarnation */
+	if (inc && (node->rn_state == RES_STARTED ||
+		    node->rn_state == RES_FAILED))
+		--inc;
+
 #ifdef DEBUG
-	env = build_env(node, depth, node->rn_resource->r_incarnations, (int)timeout);
+	env = build_env(node, depth, inc, (int)timeout);
 	if (!env)
 		return -errno;
 #endif
@@ -380,7 +388,7 @@ res_exec(resource_node_t *node, int op, const char *arg, int depth)
 #endif
 
 #ifndef DEBUG
-		env = build_env(node, depth, node->rn_resource->r_incarnations, (int)timeout);
+		env = build_env(node, depth, inc, (int)timeout);
 #endif
 
 		if (!env)


More information about the cluster-commits mailing list