ctdb-daemon: Drop handling of ban control sent to unexpected node
authorMartin Schwenke <martin@meltin.net>
Wed, 29 Jul 2015 09:34:23 +0000 (19:34 +1000)
committerAmitay Isaacs <amitay@samba.org>
Fri, 4 Dec 2015 08:17:17 +0000 (09:17 +0100)
The banning code caters for the case where the node specified in the
bantime data is not the node receiving the control.  This never
happens.  There are 2 places where ctdb_ctrl_set_ban() is called: the
ctdb CLI tool and the recovery daemon.  Both pass the same node in the
bantime data that they are sending the control to.  There are no plans
to do anything more elaborate, so just delete the handling of this
special case.

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

index 92bc5100d79370d918a74de25bb26e6584d7d165..56d3b290a93d15cece116edcf2c27c0ba9e0ccb1 100644 (file)
@@ -87,27 +87,10 @@ int32_t ctdb_control_set_ban_state(struct ctdb_context *ctdb, TDB_DATA indata)
        DEBUG(DEBUG_INFO,("SET BAN STATE\n"));
 
        if (bantime->pnn != ctdb->pnn) {
-               if (bantime->pnn >= ctdb->num_nodes) {
-                       DEBUG(DEBUG_ERR,(__location__ " ERROR: Invalid ban request. PNN:%d is invalid. Max nodes %d\n", bantime->pnn, ctdb->num_nodes));
-                       return -1;
-               }
-               if (bantime->time == 0) {
-                       DEBUG(DEBUG_NOTICE,("unbanning node %d\n", bantime->pnn));
-                       ctdb->nodes[bantime->pnn]->flags &= ~NODE_FLAGS_BANNED;
-               } else {
-                       DEBUG(DEBUG_NOTICE,("banning node %d\n", bantime->pnn));
-                       if (ctdb->tunable.enable_bans == 0) {
-                               /* FIXME: This is bogus. We really should be
-                                * taking decision based on the tunables on
-                                * the banned node and not local node.
-                                */
-                               DEBUG(DEBUG_WARNING,("Bans are disabled - ignoring ban of node %u\n", bantime->pnn));
-                               return 0;
-                       }
-
-                       ctdb->nodes[bantime->pnn]->flags |= NODE_FLAGS_BANNED;
-               }
-               return 0;
+               DEBUG(DEBUG_WARNING,
+                     ("SET_BAN_STATE control for PNN %d ignored\n",
+                      bantime->pnn));
+               return -1;
        }
 
        already_banned = false;