ctdb-recoverd: Drop function unban_all_nodes()
authorMartin Schwenke <martin@meltin.net>
Thu, 26 Nov 2015 08:31:28 +0000 (19:31 +1100)
committerAmitay Isaacs <amitay@samba.org>
Fri, 4 Dec 2015 08:17:17 +0000 (09:17 +0100)
It hasn't worked since commit cda5f02c7c3491917d831ee23b93278dfaa5c82b
in 2009, which reworked the banning code.  Since then
ctdb_control_modflags() has contained a comment saying:

  /* we don't let other nodes modify our BANNED status */

Unbanning all nodes originally occurred here when the recovery master
role moved to a new node.  The logic could have been meant for the
case when the old recovery master was malfunctioning, so got banned.
If any other nodes had been banned by this recovery master then they
would be unbanned.  However, this would also unban the old recovery
master, which is probably suboptimal.  The logic would also trigger if
a node was banned for a good reason and then the recovery master was
stopped.  So, apart from doing nothing, the logic is too simplistic so
might as well be removed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_recoverd.c

index c9f19fa8870ed1df6644b5bd0b6f79bea045ff5b..1d63526e70d09c0c4b10dc9d94aa231bb6c7a8ee 100644 (file)
@@ -2344,37 +2344,6 @@ static int send_election_request(struct ctdb_recoverd *rec, uint32_t pnn)
        return ctdb_client_send_message(ctdb, CTDB_BROADCAST_ALL, srvid, election_data);
 }
 
-/*
-  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_old *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(DEBUG_ERR,(__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) ) {
-                       ret = ctdb_ctrl_modflags(ctdb, CONTROL_TIMEOUT(),
-                                                nodemap->nodes[i].pnn, 0,
-                                                NODE_FLAGS_BANNED);
-                       if (ret != 0) {
-                               DEBUG(DEBUG_ERR, (__location__ " failed to reset ban state\n"));
-                       }
-               }
-       }
-
-       talloc_free(tmp_ctx);
-}
-
-
 /*
   we think we are winning the election - send a broadcast election request
  */
@@ -2725,7 +2694,6 @@ static void election_handler(uint64_t srvid, TDB_DATA data, void *private_data)
                                        timeval_current_ofs(0, 500000),
                                        election_send_request, rec);
                }
-               /*unban_all_nodes(ctdb);*/
                return;
        }
 
@@ -2735,7 +2703,6 @@ static void election_handler(uint64_t srvid, TDB_DATA data, void *private_data)
        /* Release the recovery lock file */
        if (ctdb_recovery_have_lock(ctdb)) {
                ctdb_recovery_unlock(ctdb);
-               unban_all_nodes(ctdb);
        }
 
        clear_ip_assignment_tree(ctdb);