Rev 620: prevent recursion in the calling of ctdb_takeover_run in
http://samba.org/~tridge/ctdb
tridge at samba.org
tridge at samba.org
Thu Sep 13 04:08:19 GMT 2007
------------------------------------------------------------
revno: 620
revision-id: tridge at samba.org-20070913040818-8zksju5tedjiftha
parent: tridge at samba.org-20070913015742-pvxju9jioih01sce
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge.test2
timestamp: Thu 2007-09-13 14:08:18 +1000
message:
prevent recursion in the calling of ctdb_takeover_run
modified:
server/ctdb_recoverd.c recoverd.c-20070503213540-bvxuyd9jm1f7ig90-1
=== modified file 'server/ctdb_recoverd.c'
--- a/server/ctdb_recoverd.c 2007-09-13 01:19:49 +0000
+++ b/server/ctdb_recoverd.c 2007-09-13 04:08:18 +0000
@@ -42,6 +42,7 @@
struct timeval first_recover_time;
struct ban_state **banned_nodes;
struct timeval priority_time;
+ bool need_takeover_run;
};
#define CONTROL_TIMEOUT() timeval_current_ofs(ctdb->tunable.recover_timeout, 0)
@@ -904,6 +905,7 @@
if enabled, tell nodes to takeover their public IPs
*/
if (ctdb->vnn) {
+ rec->need_takeover_run = false;
ret = ctdb_takeover_run(ctdb, nodemap);
if (ret != 0) {
DEBUG(0, (__location__ " Unable to setup public takeover addresses\n"));
@@ -1154,6 +1156,7 @@
TALLOC_CTX *tmp_ctx;
uint32_t changed_flags;
int i;
+ struct ctdb_recoverd *rec = talloc_get_type(private_data, struct ctdb_recoverd);
if (data.dsize != sizeof(*c)) {
DEBUG(0,(__location__ "Invalid data in ctdb_node_flag_change\n"));
@@ -1212,15 +1215,7 @@
during recovery
*/
if (changed_flags & NODE_FLAGS_DISABLED) {
- ret = ctdb_takeover_run(ctdb, nodemap);
- if (ret != 0) {
- DEBUG(0, (__location__ " Unable to setup public takeover addresses - starting recovery\n"));
- ctdb_ctrl_setrecmode(ctdb, CONTROL_TIMEOUT(),
- ctdb->pnn, CTDB_RECOVERY_ACTIVE);
- }
- /* send a message to all clients telling them that the
- cluster has been reconfigured */
- ctdb_send_message(ctdb, CTDB_BROADCAST_CONNECTED, CTDB_SRVID_RECONFIGURE, tdb_null);
+ rec->need_takeover_run = true;
}
}
@@ -1421,7 +1416,6 @@
struct ctdb_vnn_map *vnnmap=NULL;
struct ctdb_vnn_map *remote_vnnmap=NULL;
int i, j, ret;
- bool need_takeover_run;
struct ctdb_recoverd *rec;
rec = talloc_zero(ctdb, struct ctdb_recoverd);
@@ -1446,8 +1440,6 @@
ctdb_set_message_handler(ctdb, CTDB_SRVID_UNBAN_NODE, unban_handler, rec);
again:
- need_takeover_run = false;
-
if (mem_ctx) {
talloc_free(mem_ctx);
mem_ctx = NULL;
@@ -1540,7 +1532,7 @@
/* if we are not the recmaster then we do not need to check
if recovery is needed
*/
- if (pnn!=recmaster) {
+ if (pnn != recmaster) {
goto again;
}
@@ -1660,7 +1652,7 @@
matches in this code) */
if (nodemap->nodes[j].flags != remote_nodemap->nodes[j].flags) {
nodemap->nodes[j].flags = remote_nodemap->nodes[j].flags;
- need_takeover_run = true;
+ rec->need_takeover_run = true;
}
}
@@ -1748,12 +1740,13 @@
}
/* we might need to change who has what IP assigned */
- if (need_takeover_run && ctdb->vnn) {
+ if (rec->need_takeover_run) {
+ rec->need_takeover_run = false;
ret = ctdb_takeover_run(ctdb, nodemap);
if (ret != 0) {
DEBUG(0, (__location__ " Unable to setup public takeover addresses - starting recovery\n"));
- ctdb_ctrl_setrecmode(ctdb, CONTROL_TIMEOUT(),
- ctdb->pnn, CTDB_RECOVERY_ACTIVE);
+ do_recovery(rec, mem_ctx, pnn, num_active, nodemap,
+ vnnmap, nodemap->nodes[j].pnn);
}
}
More information about the samba-cvs
mailing list