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] rgmanager: Fix reference count handling (RHEL5)
Date: Tue, 26 Apr 2011 11:42:30 -0400	[thread overview]
Message-ID: <1303832550-22301-1-git-send-email-lhh@redhat.com> (raw)

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@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)
-- 
1.7.3.4



                 reply	other threads:[~2011-04-26 15:42 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=1303832550-22301-1-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).