return 0;
}
+/*
+ this function will unban all nodes in the cluster
+*/
+static void unban_all_nodes(struct ctdb_context *ctdb)
+{
+ int ret, i;
+ struct ctdb_node_map *nodemap;
+ TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
+
+ ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, tmp_ctx, &nodemap);
+ if (ret != 0) {
+ DEBUG(0,(__location__ " failed to get nodemap to unban all nodes\n"));
+ return;
+ }
+
+ for (i=0;i<nodemap->num;i++) {
+ if ( (!(nodemap->nodes[i].flags & NODE_FLAGS_DISCONNECTED))
+ && (nodemap->nodes[i].flags & NODE_FLAGS_BANNED) ) {
+ ctdb_ctrl_modflags(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[i].vnn, 0, NODE_FLAGS_BANNED);
+ }
+ }
+
+ talloc_free(tmp_ctx);
+}
/*
handler for recovery master elections
DEBUG(0, (__location__ " failed to initiate recmaster election"));
}
talloc_free(mem_ctx);
+ unban_all_nodes(ctdb);
return;
}
ctdb->recovery_lock_fd != -1) {
close(ctdb->recovery_lock_fd);
ctdb->recovery_lock_fd = -1;
- ctdb_ctrl_modflags(ctdb, CONTROL_TIMEOUT(), ctdb->vnn, 0, NODE_FLAGS_BANNED);
+ unban_all_nodes(ctdb);
}
/* ok, let that guy become recmaster then */