diff options
-rw-r--r-- | ctdb/client/ctdb_client.c | 9 | ||||
-rw-r--r-- | ctdb/include/ctdb_client.h | 4 | ||||
-rw-r--r-- | ctdb/include/ctdb_protocol.h | 2 | ||||
-rw-r--r-- | ctdb/server/ctdb_banning.c | 16 | ||||
-rw-r--r-- | ctdb/server/ctdb_control.c | 2 | ||||
-rw-r--r-- | ctdb/server/ctdb_recoverd.c | 4 | ||||
-rw-r--r-- | ctdb/tools/ctdb.c | 8 |
7 files changed, 24 insertions, 21 deletions
diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c index 7ab0545a56a..9d465f2a996 100644 --- a/ctdb/client/ctdb_client.c +++ b/ctdb/client/ctdb_client.c @@ -4709,7 +4709,8 @@ int ctdb_ctrl_disablescript(struct ctdb_context *ctdb, struct timeval timeout, u } -int ctdb_ctrl_set_ban(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, struct ctdb_ban_time *bantime) +int ctdb_ctrl_set_ban(struct ctdb_context *ctdb, struct timeval timeout, + uint32_t destnode, struct ctdb_ban_state *bantime) { int ret; TDB_DATA data; @@ -4730,7 +4731,9 @@ int ctdb_ctrl_set_ban(struct ctdb_context *ctdb, struct timeval timeout, uint32_ } -int ctdb_ctrl_get_ban(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, TALLOC_CTX *mem_ctx, struct ctdb_ban_time **bantime) +int ctdb_ctrl_get_ban(struct ctdb_context *ctdb, struct timeval timeout, + uint32_t destnode, TALLOC_CTX *mem_ctx, + struct ctdb_ban_state **bantime) { int ret; TDB_DATA outdata; @@ -4746,7 +4749,7 @@ int ctdb_ctrl_get_ban(struct ctdb_context *ctdb, struct timeval timeout, uint32_ return -1; } - *bantime = (struct ctdb_ban_time *)talloc_steal(mem_ctx, outdata.dptr); + *bantime = (struct ctdb_ban_state *)talloc_steal(mem_ctx, outdata.dptr); talloc_free(tmp_ctx); return 0; diff --git a/ctdb/include/ctdb_client.h b/ctdb/include/ctdb_client.h index 2138b916f59..6540780f77b 100644 --- a/ctdb/include/ctdb_client.h +++ b/ctdb/include/ctdb_client.h @@ -601,10 +601,10 @@ int ctdb_ctrl_disablescript(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, const char *script); int ctdb_ctrl_set_ban(struct ctdb_context *ctdb, struct timeval timeout, - uint32_t destnode, struct ctdb_ban_time *bantime); + uint32_t destnode, struct ctdb_ban_state *bantime); int ctdb_ctrl_get_ban(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, TALLOC_CTX *mem_ctx, - struct ctdb_ban_time **bantime); + struct ctdb_ban_state **bantime); int ctdb_ctrl_set_db_priority(struct ctdb_context *ctdb, struct timeval timeout, uint32_t destnode, diff --git a/ctdb/include/ctdb_protocol.h b/ctdb/include/ctdb_protocol.h index 82910ebaffd..316e1e5f972 100644 --- a/ctdb/include/ctdb_protocol.h +++ b/ctdb/include/ctdb_protocol.h @@ -813,7 +813,7 @@ struct ctdb_connection { ctdb_sock_addr dst; }; -struct ctdb_ban_time { +struct ctdb_ban_state { uint32_t pnn; uint32_t time; }; diff --git a/ctdb/server/ctdb_banning.c b/ctdb/server/ctdb_banning.c index ed85076172e..d43e89c26ef 100644 --- a/ctdb/server/ctdb_banning.c +++ b/ctdb/server/ctdb_banning.c @@ -81,7 +81,7 @@ void ctdb_local_node_got_banned(struct ctdb_context *ctdb) int32_t ctdb_control_set_ban_state(struct ctdb_context *ctdb, TDB_DATA indata) { - struct ctdb_ban_time *bantime = (struct ctdb_ban_time *)indata.dptr; + struct ctdb_ban_state *bantime = (struct ctdb_ban_state *)indata.dptr; bool already_banned; DEBUG(DEBUG_INFO,("SET BAN STATE\n")); @@ -128,12 +128,12 @@ int32_t ctdb_control_set_ban_state(struct ctdb_context *ctdb, TDB_DATA indata) return 0; } - ctdb->banning_ctx = talloc(ctdb, struct ctdb_ban_time); + ctdb->banning_ctx = talloc(ctdb, struct ctdb_ban_state); if (ctdb->banning_ctx == NULL) { DEBUG(DEBUG_CRIT,(__location__ " ERROR Failed to allocate new banning state\n")); return -1; } - *((struct ctdb_ban_time *)(ctdb->banning_ctx)) = *bantime; + *((struct ctdb_ban_state *)(ctdb->banning_ctx)) = *bantime; DEBUG(DEBUG_ERR,("Banning this node for %d seconds\n", bantime->time)); @@ -151,20 +151,20 @@ int32_t ctdb_control_set_ban_state(struct ctdb_context *ctdb, TDB_DATA indata) int32_t ctdb_control_get_ban_state(struct ctdb_context *ctdb, TDB_DATA *outdata) { - struct ctdb_ban_time *bantime; + struct ctdb_ban_state *bantime; - bantime = talloc(outdata, struct ctdb_ban_time); + bantime = talloc(outdata, struct ctdb_ban_state); CTDB_NO_MEMORY(ctdb, bantime); if (ctdb->banning_ctx != NULL) { - *bantime = *(struct ctdb_ban_time *)(ctdb->banning_ctx); + *bantime = *(struct ctdb_ban_state *)(ctdb->banning_ctx); } else { bantime->pnn = ctdb->pnn; bantime->time = 0; } outdata->dptr = (uint8_t *)bantime; - outdata->dsize = sizeof(struct ctdb_ban_time); + outdata->dsize = sizeof(struct ctdb_ban_state); return 0; } @@ -173,7 +173,7 @@ int32_t ctdb_control_get_ban_state(struct ctdb_context *ctdb, TDB_DATA *outdata) void ctdb_ban_self(struct ctdb_context *ctdb) { TDB_DATA data; - struct ctdb_ban_time bantime; + struct ctdb_ban_state bantime; bantime.pnn = ctdb->pnn; bantime.time = ctdb->tunable.recovery_ban_period; diff --git a/ctdb/server/ctdb_control.c b/ctdb/server/ctdb_control.c index 2dc64f80be2..1ba1ef796ee 100644 --- a/ctdb/server/ctdb_control.c +++ b/ctdb/server/ctdb_control.c @@ -604,7 +604,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb, return ctdb_control_disable_script(ctdb, indata); case CTDB_CONTROL_SET_BAN_STATE: - CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_ban_time)); + CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_ban_state)); return ctdb_control_set_ban_state(ctdb, indata); case CTDB_CONTROL_GET_BAN_STATE: diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c index e1f580a4fb2..5a6fadab29c 100644 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@ -267,8 +267,8 @@ static void ctdb_ban_node(struct ctdb_recoverd *rec, uint32_t pnn, uint32_t ban_ { int ret; struct ctdb_context *ctdb = rec->ctdb; - struct ctdb_ban_time bantime; - + struct ctdb_ban_state bantime; + if (!ctdb_validate_pnn(ctdb, pnn)) { DEBUG(DEBUG_ERR,("Bad pnn %u in ctdb_ban_node\n", pnn)); return; diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 2c148b02ce4..521336636d1 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -3420,7 +3420,7 @@ static uint32_t get_generation(struct ctdb_context *ctdb) /* Ban a node */ static bool update_state_banned(struct ctdb_context *ctdb, void *data) { - struct ctdb_ban_time *bantime = (struct ctdb_ban_time *)data; + struct ctdb_ban_state *bantime = (struct ctdb_ban_state *)data; int ret; ret = ctdb_ctrl_set_ban(ctdb, TIMELIMIT(), options.pnn, bantime); @@ -3430,7 +3430,7 @@ static bool update_state_banned(struct ctdb_context *ctdb, void *data) static int control_ban(struct ctdb_context *ctdb, int argc, const char **argv) { - struct ctdb_ban_time bantime; + struct ctdb_ban_state bantime; if (argc < 1) { usage(); @@ -3455,7 +3455,7 @@ static int control_ban(struct ctdb_context *ctdb, int argc, const char **argv) /* Unban a node */ static int control_unban(struct ctdb_context *ctdb, int argc, const char **argv) { - struct ctdb_ban_time bantime; + struct ctdb_ban_state bantime; bantime.pnn = options.pnn; bantime.time = 0; @@ -3474,7 +3474,7 @@ static int control_showban(struct ctdb_context *ctdb, int argc, const char **arg { int ret; struct ctdb_node_map_old *nodemap=NULL; - struct ctdb_ban_time *bantime; + struct ctdb_ban_state *bantime; /* verify the node exists */ ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), CTDB_CURRENT_NODE, ctdb, &nodemap); |