cluster: RHEL6 - Print cpg_mcast_joined() return value and errno if it fails
by Ryan McCabe
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 15993079738bf0e07e93c4f07e1816388654e283
Parent: 4378569f8f41d58313284b88aa6a54df3346546e
Author: Ryan McCabe <rmccabe(a)redhat.com>
AuthorDate: Wed Apr 25 09:34:03 2012 -0400
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Tue May 1 11:00:07 2012 -0400
Print cpg_mcast_joined() return value and errno if it fails
Signed-off-by: Ryan McCabe <rmccabe(a)redhat.com>
Reviewed-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
rgmanager/src/daemons/cpglockd.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/rgmanager/src/daemons/cpglockd.c b/rgmanager/src/daemons/cpglockd.c
index a3943a2..689c494 100644
--- a/rgmanager/src/daemons/cpglockd.c
+++ b/rgmanager/src/daemons/cpglockd.c
@@ -436,7 +436,8 @@ send_lock_msg(struct cpg_lock_msg *m)
do {
ret = cpg_mcast_joined(cpg, CPG_TYPE_AGREED, &iov, 1);
if (ret != CPG_OK) {
- logt_print(LOG_DEBUG, "send_lock_msg() failed\n");
+ logt_print(LOG_DEBUG, "send_lock_msg() failed %d: %s\n",
+ ret, strerror(errno));
usleep(250000);
}
} while (ret != CPG_OK && !shutdown_pending);
12 years
cluster: RHEL6 - rgmanager: fix cpglockd vs rgmanager startup race condition with systemd
by Ryan McCabe
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 4378569f8f41d58313284b88aa6a54df3346546e
Parent: 9310d1ad3a19fbe1aff6238ebc8ce9730a43440f
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Wed Apr 25 09:25:07 2012 +0200
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Tue May 1 11:00:00 2012 -0400
rgmanager: fix cpglockd vs rgmanager startup race condition with systemd
systemd consider a service fully operation as soon as /var/run/foo.pid is
written.
this creates a small window in which rgmanager can start before cpglockd
is operational and rgmanager would fail.
loop over cpglockdump to verify that cpglockd is functional and then
start rgmanager
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
Reviewed-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-by: Ryan McCabe <rmccabe(a)redhat.com>
---
rgmanager/init.d/rgmanager.in | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/rgmanager/init.d/rgmanager.in b/rgmanager/init.d/rgmanager.in
index fcf7698..e602ba0 100644
--- a/rgmanager/init.d/rgmanager.in
+++ b/rgmanager/init.d/rgmanager.in
@@ -79,6 +79,7 @@ start_cpglockd()
{
rings="$(corosync-objctl 2>/dev/null |grep ringnumber | wc -l)"
[ "$rings" -gt "1" ] && service cpglockd start
+ while ! cpglockdump > /dev/null 2>&1; do sleep 1; done
}
rtrn=0
12 years
cluster: RHEL6 - Fix operation when quorum is lost: - NAK all pending requests - Drop all locks - Until quorum is regained, NAK all new lock requests
by Ryan McCabe
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 9310d1ad3a19fbe1aff6238ebc8ce9730a43440f
Parent: ff5569b44f106a518908d8a1c8c2791a09744ccd
Author: Ryan McCabe <rmccabe(a)redhat.com>
AuthorDate: Tue Apr 24 23:54:36 2012 -0400
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Tue May 1 10:59:44 2012 -0400
Fix operation when quorum is lost: - NAK all pending requests - Drop all locks - Until quorum is regained, NAK all new lock requests
Signed-off-by: Ryan McCabe <rmccabe(a)redhat.com>
Reviewed-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
rgmanager/src/daemons/cpglockd.c | 110 ++++++++++++++++++++++++++++++++------
1 files changed, 94 insertions(+), 16 deletions(-)
diff --git a/rgmanager/src/daemons/cpglockd.c b/rgmanager/src/daemons/cpglockd.c
index d4d43b0..a3943a2 100644
--- a/rgmanager/src/daemons/cpglockd.c
+++ b/rgmanager/src/daemons/cpglockd.c
@@ -588,15 +588,20 @@ del_client(int fd)
logt_print(LOG_DEBUG, "RECOVERY: Looking for locks held by PID %d\n", pid);
- /* This may not be needed */
- purge_requests(my_node_id, pid);
+ if (cluster_quorate) {
+ /* This may not be needed */
+ purge_requests(my_node_id, pid);
- memset(&m, 0, sizeof(m));
- m.request = MSG_PURGE;
- m.owner_nodeid = my_node_id;
- m.owner_pid = pid;
+ memset(&m, 0, sizeof(m));
+ m.request = MSG_PURGE;
+ m.owner_nodeid = my_node_id;
+ m.owner_pid = pid;
- send_lock_msg(&m);
+ send_lock_msg(&m);
+ }
+
+ if (!cluster_quorate && locks != NULL)
+ logt_print(LOG_DEBUG, "RECOVERY: not quorate but locks exist\n");
list_for(&locks, l, x) {
if (l->l.owner_nodeid != my_node_id ||
@@ -1385,6 +1390,36 @@ static void init_logging(int reconf)
logt_conf("cpglockd", mode, syslog_facility, syslog_priority, logfile_priority, logfile);
}
+static void
+clear_local_state(void)
+{
+ struct request_node *cur_req = NULL;
+ struct lock_node *cur_lock = NULL;
+
+ while ((cur_lock = locks) != NULL) {
+ logt_print(LOG_DEBUG,
+ "CLEAR STATE: Dropping lock %s [%d:%d]\n",
+ cur_lock->l.resource,
+ cur_lock->l.owner_nodeid, cur_lock->l.owner_pid);
+ list_remove(&locks, cur_lock);
+ free(cur_lock);
+ }
+
+ while ((cur_req = requests) != NULL) {
+ if (cur_req->l.owner_nodeid == my_node_id) {
+ nak_client(cur_req);
+ logt_print(LOG_DEBUG, "CLEAR STATE: sent NAK %s [%d:%d:%d]\n",
+ cur_req->l.resource, cur_req->l.owner_nodeid,
+ cur_req->l.owner_pid, cur_req->l.owner_tid);
+ }
+ logt_print(LOG_DEBUG, "CLEAR STATE: Dropping request %s [%d:%d:%d]\n",
+ cur_req->l.resource, cur_req->l.owner_nodeid,
+ cur_req->l.owner_pid, cur_req->l.owner_tid);
+ list_remove(&requests, cur_req);
+ free(cur_req);
+ }
+}
+
int
main(int argc, char **argv)
{
@@ -1394,6 +1429,7 @@ main(int argc, char **argv)
int afd = -1;
int cman_fd;
int n,x;
+ int quorate_last = 0;
int wait_for_quorum = 1;
int wait_for_fencing = 1;
int opt;
@@ -1525,6 +1561,10 @@ main(int argc, char **argv)
goto out;
}
+ if (wait_for_quorum)
+ wait_for_quorum_formation(cman_handle);
+ quorate_last = cluster_quorate;
+
logt_print(LOG_INFO, "cpglockd entering normal operation\n");
while (!shutdown_pending) {
struct timeval tv;
@@ -1569,6 +1609,16 @@ main(int argc, char **argv)
goto out;
}
+ if (!quorate_last && cluster_quorate)
+ logt_print(LOG_INFO, "Cluster quorum regained\n");
+
+ if (quorate_last && !cluster_quorate) {
+ logt_print(LOG_INFO,
+ "Cluster lost quorum. Clearing local state.\n");
+ clear_local_state();
+ }
+ quorate_last = cluster_quorate;
+
fence_check:
list_for(&pending_fencing, pf_node, x) {
int victim;
@@ -1640,16 +1690,23 @@ main(int argc, char **argv)
if (FD_ISSET(fd, &rfds)) {
afd = accept(fd, NULL, NULL);
- insert_client(afd);
+ if (afd < 0) {
+ logt_print(LOG_DEBUG, "Error accepting new client: %s\n",
+ strerror(errno));
+ } else {
+ insert_client(afd);
+ }
--n;
}
if (FD_ISSET(cpgfd, &rfds)) {
- if (cpg_dispatch(cpg, CPG_DISPATCH_ALL) != CPG_OK) {
+ --n;
+ if (cluster_quorate &&
+ cpg_dispatch(cpg, CPG_DISPATCH_ALL) != CPG_OK)
+ {
logt_print(LOG_ERR, "Fatal: Lost CPG connection.\n");
return -1;
}
- --n;
}
if (n <= 0)
@@ -1660,9 +1717,10 @@ main(int argc, char **argv)
if (!FD_ISSET(client->fd, &rfds))
continue;
--n;
+
if (read_retry(client->fd, &m, sizeof(m), NULL) < 0) {
logt_print(LOG_DEBUG, "Closing client fd %d pid %d: %d\n",
- client->fd, client->pid, errno);
+ client->fd, client->pid, errno);
del_client(client->fd);
break;
@@ -1671,15 +1729,35 @@ main(int argc, char **argv)
/* send lock request */
/* XXX check for dup connection */
if (m.request == MSG_LOCK) {
- client->pid = m.owner_pid;
- send_lock(&m);
+ if (!cluster_quorate) {
+ logt_print(LOG_DEBUG, "Sending NAK for new lock request while not quorate (%s [%d:%d:%d])\n",
+ m.resource, m.owner_nodeid,
+ m.owner_pid, m.owner_tid);
+
+ m.request = MSG_NAK;
+ if (write_retry(client->fd, &m, sizeof(m), NULL) < 0) {
+ logt_print(LOG_DEBUG,
+ "Error sending NAK for %s [%d:%d:%d]: %s\n",
+ m.resource, m.owner_nodeid,
+ m.owner_pid, m.owner_tid, strerror(errno));
+ }
+ } else {
+ client->pid = m.owner_pid;
+ send_lock(&m);
+ }
}
if (m.request == MSG_UNLOCK) {
//logt_print(LOG_DEBUG, "Unlock from fd %d\n", client->fd);
- find_lock(&m);
- if (grant_next(&m) == 0)
- send_unlock(&m);
+ /*
+ ** When not quorate, all locks and requests have already
+ ** been dropped.
+ */
+ if (cluster_quorate) {
+ find_lock(&m);
+ if (grant_next(&m) == 0)
+ send_unlock(&m);
+ }
}
if (m.request == MSG_DUMP) {
12 years
cluster: RHEL6 - cpglockd: show that we are alive while waiting for quorum (debug info)
by Ryan McCabe
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: ff5569b44f106a518908d8a1c8c2791a09744ccd
Parent: bc516e029691845a7c63adfe094d67069df920ab
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Wed Apr 25 05:21:51 2012 +0200
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Tue May 1 10:59:38 2012 -0400
cpglockd: show that we are alive while waiting for quorum (debug info)
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
Reviewed-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-by: Ryan McCabe <rmccabe(a)redhat.com>
---
rgmanager/src/daemons/cpglockd.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/rgmanager/src/daemons/cpglockd.c b/rgmanager/src/daemons/cpglockd.c
index 2e35f7f..d4d43b0 100644
--- a/rgmanager/src/daemons/cpglockd.c
+++ b/rgmanager/src/daemons/cpglockd.c
@@ -248,9 +248,10 @@ wait_for_fencing_join(int nodeid)
static void
wait_for_quorum_formation(cman_handle_t ch) {
- logt_print(LOG_DEBUG, "Waiting for quorum to form\n");
- while (!shutdown_pending && !(cluster_quorate = cman_is_quorate(ch)))
+ while (!shutdown_pending && !(cluster_quorate = cman_is_quorate(ch))) {
+ logt_print(LOG_DEBUG, "Waiting for quorum to form\n");
sleep(1);
+ }
logt_print(LOG_DEBUG, "Quorum formed\n");
}
12 years
cluster: RHEL6 - If we see a JOIN message from ourselves, move ourselves to the end of the membership list.
by Ryan McCabe
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: bc516e029691845a7c63adfe094d67069df920ab
Parent: d764a6befb0e8edcf8a2c797164b98a5b272a565
Author: Ryan McCabe <rmccabe(a)redhat.com>
AuthorDate: Tue Apr 24 12:56:24 2012 -0400
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Tue May 1 10:59:32 2012 -0400
If we see a JOIN message from ourselves, move ourselves to the end of the membership list.
Signed-off-by: Ryan McCabe <rmccabe(a)redhat.com>
Reviewed-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
rgmanager/src/daemons/cpglockd.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/rgmanager/src/daemons/cpglockd.c b/rgmanager/src/daemons/cpglockd.c
index 7d4882d..2e35f7f 100644
--- a/rgmanager/src/daemons/cpglockd.c
+++ b/rgmanager/src/daemons/cpglockd.c
@@ -1094,8 +1094,16 @@ process_join(struct cpg_lock_msg *m, uint32_t nodeid, uint32_t pid)
list_for(&group_members, n, x) {
if (n->nodeid == nodeid) {
- logt_print(LOG_DEBUG, "IGNORING JOIN from existing member %d.%d (%d.%d)\n",
- nodeid, pid, nodeid, n->pid);
+ if (n->pid == pid) {
+ logt_print(LOG_DEBUG, "Saw JOIN from self (%d.%d)\n",
+ nodeid, pid);
+ list_remove(&group_members, n);
+ list_append(&group_members, n);
+ } else {
+ logt_print(LOG_DEBUG,
+ "IGNORING JOIN from existing member %d.%d (%d.%d)\n",
+ nodeid, pid, nodeid, n->pid);
+ }
return 0;
}
}
12 years
cluster: RHEL6 - Convert all remaining calls to printf and perror for error reporting to logt_print()
by Ryan McCabe
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: d764a6befb0e8edcf8a2c797164b98a5b272a565
Parent: c9a9dbaf2f0c954a1667341d62380ef1b83f1009
Author: Ryan McCabe <rmccabe(a)redhat.com>
AuthorDate: Tue Apr 24 12:54:51 2012 -0400
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Tue May 1 10:59:24 2012 -0400
Convert all remaining calls to printf and perror for error reporting to logt_print()
Signed-off-by: Ryan McCabe <rmccabe(a)redhat.com>
Reviewed-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
rgmanager/src/daemons/cpglockd.c | 38 +++++++++++++++++++++++---------------
1 files changed, 23 insertions(+), 15 deletions(-)
diff --git a/rgmanager/src/daemons/cpglockd.c b/rgmanager/src/daemons/cpglockd.c
index 7e1ae33..7d4882d 100644
--- a/rgmanager/src/daemons/cpglockd.c
+++ b/rgmanager/src/daemons/cpglockd.c
@@ -1314,12 +1314,12 @@ cpg_init(void)
memset(&cpg, 0, sizeof(cpg));
if (cpg_initialize(&cpg, &my_callbacks) != CPG_OK) {
- perror("cpg_initialize");
+ logt_print(LOG_DEBUG, "cpg_initialize failed");
return -1;
}
if (cpg_join(cpg, &gname) != CPG_OK) {
- perror("cpg_join");
+ logt_print(LOG_DEBUG, "cpg_join failed");
return -1;
}
@@ -1327,7 +1327,8 @@ cpg_init(void)
ret = cpg_membership_get(cpg, &gname, member_list, &cpg_member_list_len);
if (ret != CPG_OK) {
- fprintf(stderr, "cpg_membership_get() failed: %s", strerror(errno));
+ logt_print(LOG_DEBUG,
+ "cpg_membership_get() failed: %s", strerror(errno));
cpg_fin();
return -1;
}
@@ -1335,7 +1336,7 @@ cpg_init(void)
for (i = 0 ; i < cpg_member_list_len ; i++) {
if (member_list[i].nodeid == my_node_id) {
if (member_list[i].pid != getpid()) {
- fprintf(stderr, "nodeid %d already in group with PID %u %u\n",
+ logt_print(LOG_DEBUG, "nodeid %d already in group with PID %u %u\n",
member_list[i].nodeid, member_list[i].pid, getpid());
cpg_fin();
return -1;
@@ -1437,7 +1438,7 @@ main(int argc, char **argv)
cman_connect(&cman_handle);
if (cman_handle == NULL) {
- fprintf(stderr, "Unable to connect to cman\n");
+ logt_print(LOG_ERR, "Unable to connect to cman\n");
exit_status = -1;
goto out4;
}
@@ -1455,7 +1456,7 @@ main(int argc, char **argv)
cman_get_node(cman_handle, CMAN_NODEID_US, &my_node);
if (my_node.cn_nodeid == 0) {
- fprintf(stderr, "Unable to get our cluster node ID\n");
+ logt_print(LOG_ERR, "Unable to get our cluster node ID\n");
exit_status = -1;
goto out3;
}
@@ -1473,14 +1474,14 @@ main(int argc, char **argv)
sizeof(cman_nodes) / sizeof(cman_nodes[0]),
&cman_node_count, cman_nodes);
if (ret < 0) {
- fprintf(stderr, "Unable to get cman nodes list\n");
+ logt_print(LOG_ERR, "Unable to get cman nodes list\n");
exit_status = -1;
goto out3;
}
cman_fd = cman_get_fd(cman_handle);
if (cman_fd < 0) {
- fprintf(stderr, "Error: cman fd is %d\n", cman_fd);
+ logt_print(LOG_ERR, "Error: cman fd is %d\n", cman_fd);
exit_status = -1;
goto out3;
}
@@ -1488,16 +1489,21 @@ main(int argc, char **argv)
cman_start_notification(cman_handle, cman_callback);
if (cpg_init() < 0) {
- fprintf(stderr, "Unable to join CPG group\n");
+ logt_print(LOG_ERR, "Unable to join CPG group\n");
exit_status = -1;
goto out2;
}
- assert(my_node.cn_nodeid == my_node_id);
+ if (my_node.cn_nodeid != my_node_id) {
+ logt_print(LOG_ERR, "cman nodeid and CPG node id differ: %d != %d\n",
+ my_node.cn_nodeid, my_node_id);
+ exit_status = -1;
+ goto out1;
+ }
fd = sock_listen(CPG_LOCKD_SOCK);
if (fd < 0) {
- fprintf(stderr, "Error connecting to %s: %s\n",
+ logt_print(LOG_ERR, "Error connecting to %s: %s\n",
CPG_LOCKD_SOCK, strerror(errno));
exit_status = -1;
goto out1;
@@ -1505,10 +1511,12 @@ main(int argc, char **argv)
cpg_fd_get(cpg, &cpgfd);
if (cpgfd < 0 || send_join() < 0) {
+ logt_print(LOG_ERR, "Unable to complete join to CPG group\n");
exit_status = -1;
goto out;
}
+ logt_print(LOG_INFO, "cpglockd entering normal operation\n");
while (!shutdown_pending) {
struct timeval tv;
struct pending_fence_node *pf_node;
@@ -1531,14 +1539,14 @@ main(int argc, char **argv)
n = select_retry(x+1, &rfds, NULL, NULL, &tv);
if (n < 0) {
- fprintf(stderr, "Error: select: %s\n", strerror(errno));
+ logt_print(LOG_ERR, "Error: select: %s\n", strerror(errno));
exit_status = -1;
goto out;
}
if (FD_ISSET(cman_fd, &rfds)) {
if (cman_dispatch(cman_handle, CMAN_DISPATCH_ALL) < 0) {
- fprintf(stderr, "Fatal: cman_dispatch() failed: %s\n",
+ logt_print(LOG_ERR, "Fatal: cman_dispatch() failed: %s\n",
strerror(errno));
exit_status = -1;
goto out;
@@ -1547,7 +1555,7 @@ main(int argc, char **argv)
}
if (cman_shutdown_requested) {
- fprintf(stderr, "Fatal: cman requested shutdown.\n");
+ logt_print(LOG_INFO, "cman requested shutdown. Exiting.\n");
cman_replyto_shutdown(cman_handle, 1);
goto out;
}
@@ -1629,7 +1637,7 @@ main(int argc, char **argv)
if (FD_ISSET(cpgfd, &rfds)) {
if (cpg_dispatch(cpg, CPG_DISPATCH_ALL) != CPG_OK) {
- fprintf(stderr, "Fatal: Lost CPG connection.\n");
+ logt_print(LOG_ERR, "Fatal: Lost CPG connection.\n");
return -1;
}
--n;
12 years
cluster: RHEL6 - rgmanager: die hard if we cpglockd dies
by Ryan McCabe
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: c9a9dbaf2f0c954a1667341d62380ef1b83f1009
Parent: f428fc18c95839c53d4b04f13ea84c529d77a024
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Tue Apr 24 16:30:32 2012 +0200
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Tue May 1 10:59:18 2012 -0400
rgmanager: die hard if we cpglockd dies
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
Reviewed-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-by: Ryan McCabe <rmccabe(a)redhat.com>
---
rgmanager/src/clulib/cpg_lock.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/rgmanager/src/clulib/cpg_lock.c b/rgmanager/src/clulib/cpg_lock.c
index 7cff2a3..d257cf4 100644
--- a/rgmanager/src/clulib/cpg_lock.c
+++ b/rgmanager/src/clulib/cpg_lock.c
@@ -12,6 +12,7 @@
#include <sys/types.h>
#include <sys/select.h>
#include <pthread.h>
+#include <signal.h>
#include <cpglock.h>
@@ -69,9 +70,13 @@ _cpg_lock(int mode,
ret = cpg_lock(_cpgh, resource, 1, &l);
else
ret = cpg_lock(_cpgh, resource, 0, &l);
-
+
if (ret == 0) {
cpg2dlm(&l, lksb);
+ } else {
+ if (errno == EPIPE) {
+ raise(SIGSEGV);
+ }
}
return ret;
12 years
cluster: RHEL6 - rgmanager: Transmogrify states to expected values
by Ryan McCabe
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: f428fc18c95839c53d4b04f13ea84c529d77a024
Parent: 22b4572b24a6d896229da908517a0a3ddd686985
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Tue Apr 24 10:23:33 2012 -0400
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Tue May 1 10:59:11 2012 -0400
rgmanager: Transmogrify states to expected values
Because central_processing looks for state == 0 and LOCK_HELD is
2, we need to flip the states to match DLM states.
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
Reviewed-by: Ryan McCabe <rmccabe(a)redhat.com>
---
rgmanager/src/clulib/cpg_lock.c | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/rgmanager/src/clulib/cpg_lock.c b/rgmanager/src/clulib/cpg_lock.c
index a747419..7cff2a3 100644
--- a/rgmanager/src/clulib/cpg_lock.c
+++ b/rgmanager/src/clulib/cpg_lock.c
@@ -24,15 +24,34 @@ dlm2cpg(struct dlm_lksb *dlm, struct cpg_lock *cpg)
{
memset(cpg, 0, sizeof(*cpg));
cpg->local_id = dlm->sb_lkid;
- cpg->state = dlm->sb_status;
+ switch(dlm->sb_status) {
+ case 0:
+ cpg->state = LOCK_HELD;
+ break;
+ case EINPROG:
+ cpg->state = LOCK_PENDING;
+ break;
+ default:
+ cpg->state = LOCK_FREE;
+ break;
+ }
}
static void
cpg2dlm(struct cpg_lock *cpg, struct dlm_lksb *dlm)
{
memset(dlm, 0, sizeof(*dlm));
- dlm->sb_status = cpg->state;
dlm->sb_lkid = cpg->local_id;
+ switch(cpg->state) {
+ case LOCK_HELD:
+ dlm->sb_status = 0;
+ break;
+ case LOCK_PENDING:
+ default:
+ /* XXX LOCK_FREE -> DLM state? */
+ dlm->sb_status = EINPROG;
+ break;
+ }
}
12 years
cluster: RHEL6 - cpglockd: refuse to shutdown if clients are connected
by Ryan McCabe
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 07b7db55437342aab9d51852121d96e4bff2b6c1
Parent: 7f97877bb418014bfe9bc3fb6fff554ad98c22aa
Author: Fabio M. Di Nitto <fdinitto(a)redhat.com>
AuthorDate: Tue Apr 24 15:58:31 2012 +0200
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Tue May 1 10:58:51 2012 -0400
cpglockd: refuse to shutdown if clients are connected
or bad things will happen
Signed-off-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
Reviewed-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-by: Ryan McCabe <rmccabe(a)redhat.com>
---
rgmanager/src/daemons/cpglockd.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/rgmanager/src/daemons/cpglockd.c b/rgmanager/src/daemons/cpglockd.c
index 47cbcdc..7e1ae33 100644
--- a/rgmanager/src/daemons/cpglockd.c
+++ b/rgmanager/src/daemons/cpglockd.c
@@ -89,6 +89,10 @@ static void init_logging(int reconf);
static void
flag_shutdown(int __attribute__ ((unused)) sig)
{
+ if (clients) {
+ logt_print(LOG_INFO, "Clients are connected to cpglockd. Refusing to shutdown\n");
+ return;
+ }
shutdown_pending = 1;
}
@@ -1429,6 +1433,7 @@ main(int argc, char **argv)
setup_signal(SIGPIPE, SIG_IGN);
setup_signal(SIGTERM, flag_shutdown);
+ setup_signal(SIGINT, flag_shutdown);
cman_connect(&cman_handle);
if (cman_handle == NULL) {
12 years
cluster: RHEL6 - Avoid a free() of an uninitialized variable when central processing is enabled.
by Ryan McCabe
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 22b4572b24a6d896229da908517a0a3ddd686985
Parent: 07b7db55437342aab9d51852121d96e4bff2b6c1
Author: Ryan McCabe <rmccabe(a)redhat.com>
AuthorDate: Tue Apr 24 10:10:48 2012 -0400
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Tue May 1 10:58:57 2012 -0400
Avoid a free() of an uninitialized variable when central processing is enabled.
Signed-off-by: Ryan McCabe <rmccabe(a)redhat.com>
Reviewed-by: Lon Hohberger <lhh(a)redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto(a)redhat.com>
---
rgmanager/src/daemons/rg_event.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/rgmanager/src/daemons/rg_event.c b/rgmanager/src/daemons/rg_event.c
index 7048bc6..6b1023a 100644
--- a/rgmanager/src/daemons/rg_event.c
+++ b/rgmanager/src/daemons/rg_event.c
@@ -247,7 +247,7 @@ static int
find_master(void)
{
event_master_t *masterinfo = NULL;
- void *data;
+ void *data = NULL;
uint32_t sz;
cluster_member_list_t *m;
uint64_t vn;
12 years