check for recursive bans in ctdb_ban_node() and remove the previous ban
authorRonnie Sahlberg <sahlberg@ronnie>
Fri, 23 Nov 2007 01:38:37 +0000 (12:38 +1100)
committerRonnie Sahlberg <sahlberg@ronnie>
Fri, 23 Nov 2007 01:38:37 +0000 (12:38 +1100)
if this is an attempt to ban an already banned node

(This used to be ctdb commit 214f2d7b04d0a491d466fc85c8d016efde416f9e)

ctdb/server/ctdb_recoverd.c

index 8b1f747cb672132d3e2a46df3b2042cb9ecb2181..5c72e90e934528d6fc7603662966296a21d581f6 100644 (file)
@@ -130,6 +130,12 @@ static void ctdb_ban_node(struct ctdb_recoverd *rec, uint32_t pnn, uint32_t ban_
 
        ctdb_ctrl_modflags(ctdb, CONTROL_TIMEOUT(), pnn, NODE_FLAGS_BANNED, 0);
 
+       if (rec->banned_nodes[pnn] != NULL) {
+               DEBUG(0,("Re-banning an already banned node. Remove previous ban and set a new ban.\n"));               
+               talloc_free(rec->banned_nodes[pnn]);
+               rec->banned_nodes[pnn] = NULL;
+       }
+
        rec->banned_nodes[pnn] = talloc(rec, struct ban_state);
        CTDB_NO_MEMORY_FATAL(ctdb, rec->banned_nodes[pnn]);