From: Ryan McCabe <rmccabe@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] rgmanager: Fix for deadlock
Date: Mon, 1 Oct 2012 11:29:26 -0400 [thread overview]
Message-ID: <20121001152923.GA524811@redhat.com> (raw)
This patch fixes a deadlock in rgmanager that could occur when a node
starts rgmanager while a service is recovering.
Resolves: rhbz#834459
Signed-off-by: Ryan McCabe <rmccabe@redhat.com>
---
rgmanager/src/daemons/rg_state.c | 1 +
rgmanager/src/daemons/rg_thread.c | 17 ++++++++++++++++-
rgmanager/src/daemons/service_op.c | 1 +
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
index 9000f1b..b447cb3 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -2009,6 +2009,7 @@ retry:
/* Deliberate */
case RG_EDEPEND:
case RG_EFAIL:
+ case RG_EDEADLCK:
/* Uh oh - we failed to relocate to this node.
ensure that we tell the next node to start it from
the 'recovering' state. */
diff --git a/rgmanager/src/daemons/rg_thread.c b/rgmanager/src/daemons/rg_thread.c
index 769ca1e..60bf0c6 100644
--- a/rgmanager/src/daemons/rg_thread.c
+++ b/rgmanager/src/daemons/rg_thread.c
@@ -23,6 +23,7 @@
#include <rg_queue.h>
#include <assert.h>
#include <members.h>
+#include <clulog.h>
/**
* Resource thread list entry.
@@ -749,13 +750,27 @@ rt_enqueue_request(const char *resgroupname, int request,
msg_free_ctx(response_ctx);
break;
}
- fprintf(stderr, "Failed to queue request: Would block\n");
+ pthread_mutex_unlock(resgroup->rt_queue_mutex);
+ pthread_mutex_unlock(&reslist_mutex);
+ clulog(LOG_DEBUG, "Failed to queue request: Would block\n");
/* EWOULDBLOCK */
+ return -1;
+ }
+
+ if (resgroup->rt_request == RG_START &&
+ (request == RG_START_REMOTE || request == RG_START_RECOVER)) {
+ send_ret(response_ctx, resgroup->rt_name, RG_EDEADLCK,
+ request, 0);
+ msg_free_ctx(response_ctx);
pthread_mutex_unlock(resgroup->rt_queue_mutex);
pthread_mutex_unlock(&reslist_mutex);
+ clulog(LOG_DEBUG,
+ "Failed to queue %d request for %s: Would block\n",
+ request, resgroupname);
return -1;
}
+
ret = rq_queue_request(resgroup->rt_queue, resgroup->rt_name,
request, 0, 0, response_ctx, 0, target,
arg0, arg1);
diff --git a/rgmanager/src/daemons/service_op.c b/rgmanager/src/daemons/service_op.c
index 2ea59f9..bf0e1fc 100644
--- a/rgmanager/src/daemons/service_op.c
+++ b/rgmanager/src/daemons/service_op.c
@@ -82,6 +82,7 @@ service_op_start(char *svcName,
++dep;
continue;
case RG_EFAIL:
+ case RG_EDEADLCK:
++fail;
continue;
case RG_EABORT:
--
1.7.11.4
next reply other threads:[~2012-10-01 15:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-01 15:29 Ryan McCabe [this message]
2012-10-02 15:31 ` [Cluster-devel] [PATCH] rgmanager: Fix for deadlock Lon Hohberger
-- strict thread matches above, loose matches on Subject: below --
2012-09-27 19:18 Ryan McCabe
2012-09-28 19:08 ` 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=20121001152923.GA524811@redhat.com \
--to=rmccabe@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).