public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
From: Lon Hohberger <lon@fedoraproject.org>
To: cluster-cvs-relay@redhat.com
Subject: rgmanager: master - rgmanager: Fix restart-after-migrate issue
Date: Mon, 22 Jun 2009 16:54:00 -0000	[thread overview]
Message-ID: <20090622165327.00E2112020D@lists.fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/rgmanager.git?p=rgmanager.git;a=commitdiff;h=b05f0232be04683e6ac13f2ef0e40e01b7e76695
Commit:        b05f0232be04683e6ac13f2ef0e40e01b7e76695
Parent:        f6b0f97da4ea4374f0e0b7e2f7a42d99af6371b5
Author:        Lon Hohberger <lhh@redhat.com>
AuthorDate:    Thu Jun 11 11:30:56 2009 -0400
Committer:     Lon Hohberger <lhh@redhat.com>
CommitterDate: Mon Jun 22 12:47:26 2009 -0400

rgmanager: Fix restart-after-migrate issue

* Ensures we use RG_STATUS_INQUIRY when determining
if migration has completed
* Ensures that subsequent RG_STATUS checks clear any
NEEDSTOP flags to reduce the risk of other (yet-unknown)
conditions causing erroneous restarts

Resolves Red Hat Bugzilla #505340

Signed-off-by: Lon Hohberger <lhh@redhat.com>
---
 rgmanager/src/daemons/restree.c  |   13 ++++++++-----
 rgmanager/src/daemons/rg_state.c |   16 ++++++++++++----
 2 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/rgmanager/src/daemons/restree.c b/rgmanager/src/daemons/restree.c
index 5ab4b3d..8575d16 100644
--- a/rgmanager/src/daemons/restree.c
+++ b/rgmanager/src/daemons/restree.c
@@ -1083,18 +1083,20 @@ _res_op_by_level(resource_node_t **tree, resource_t *first, void *ret,
 
 
 void
-mark_nodes(resource_node_t *node, int state, int flags)
+mark_nodes(resource_node_t *node, int state, int setflags, int clearflags)
 {
 	int x;
 	resource_node_t *child;
 
 	list_for(&node->rn_child, child, x) {
 		if (child->rn_child)
-			mark_nodes(child->rn_child, state, flags);
+			mark_nodes(child->rn_child, state, setflags,
+				   clearflags);
 	}
 
 	node->rn_state = state;
-	node->rn_flags |= (RF_NEEDSTART | RF_NEEDSTOP);
+	node->rn_flags |= (setflags);
+	node->rn_flags &= ~(clearflags);
 }
 
 
@@ -1356,7 +1358,7 @@ _res_op_internal(resource_node_t __attribute__ ((unused)) **tree,
 			   node is independent or not.
 			 */
 			mark_nodes(node, RES_FAILED,
-				   RF_NEEDSTART | RF_NEEDSTOP);
+				   RF_NEEDSTART | RF_NEEDSTOP, 0);
 
 			/* If we're an independent subtree, return a flag
 			   stating that this section is recoverable apart
@@ -1369,6 +1371,7 @@ _res_op_internal(resource_node_t __attribute__ ((unused)) **tree,
 			return SFL_FAILURE;
 		}
 
+		mark_nodes(node, RES_STARTED, 0, RF_NEEDSTOP);
 	}
 
        if (node->rn_child) {
@@ -1383,7 +1386,7 @@ _res_op_internal(resource_node_t __attribute__ ((unused)) **tree,
 		if (op == RS_STATUS && (rv & SFL_FAILURE) &&
 		    (node->rn_flags & RF_INDEPENDENT)) {
 			mark_nodes(node, RES_FAILED,
-				   RF_NEEDSTART | RF_NEEDSTOP);
+				   RF_NEEDSTART | RF_NEEDSTOP, 0);
 			rv = SFL_RECOVERABLE;
 		}
 	}
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
index 4808ddf..cddbaa6 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -1157,12 +1157,20 @@ svc_status(char *svcName)
 		/* Don't check status for anything not owned */
 		return 0;
 
-	if (svcStatus.rs_state != RG_STATE_STARTED &&
-	    svcStatus.rs_state != RG_STATE_MIGRATE)
+	if (svcStatus.rs_state == RG_STATE_STARTED) {
+		/* Running locally and not migrating = normal status
+		 * check
+		 */
+		ret = group_op(svcName, RG_STATUS);
+	} else if (svcStatus.rs_state == RG_STATE_MIGRATE) {
+		/* Migrating resources need an inquiry check to avoid
+		 * setting NEEDSTOP/NEEDSTART in the resource tree.
+		 */
+		ret = group_op(svcName, RG_STATUS_INQUIRY);
+	} else {
 		/* Not-running RGs should not be checked either. */
 		return 0;
-
-	ret = group_op(svcName, RG_STATUS);
+	}
 
 	/* For running services, if the return code is 0, we're done*/
 	if (svcStatus.rs_state == RG_STATE_STARTED)


                 reply	other threads:[~2009-06-22 16:53 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=20090622165327.00E2112020D@lists.fedorahosted.org \
    --to=lon@fedoraproject.org \
    --cc=cluster-cvs-relay@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 read-only IMAP folder(s) and NNTP newsgroup(s).