The branch, master has been updated via 6dc75c7 ctdb-daemon: When releasing an IP, update PNN in callback via 976a50a ctdb-daemon: Rename takeover_callback_state -> release_ip_callback_state from 6910d3a lib: Implement poll_timeout
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 6dc75c7d24325d2070eb7feab5399dbfda50da96 Author: Martin Schwenke <mar...@meltin.net> Date: Fri Aug 19 16:38:50 2016 +1000 ctdb-daemon: When releasing an IP, update PNN in callback When an error occurs so an IP address is not released then the PNN in the VNN is currently incorrectly updated. Instead, update the PNN in the callback when the release is successful. Also, explicitly update the PNN on redundant releases. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12158 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> Autobuild-User(master): Amitay Isaacs <ami...@samba.org> Autobuild-Date(master): Sun Aug 21 22:45:33 CEST 2016 on sn-devel-144 commit 976a50af6f045765c7bf1961e26efc3cba17f3ba Author: Martin Schwenke <mar...@meltin.net> Date: Fri Aug 19 16:30:46 2016 +1000 ctdb-daemon: Rename takeover_callback_state -> release_ip_callback_state Many years ago takeover_callback_state was used for both IP takeover and release. Now it is only used when releasing an IP so rename it to improve clarity. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12158 Signed-off-by: Martin Schwenke <mar...@meltin.net> Reviewed-by: Amitay Isaacs <ami...@gmail.com> ----------------------------------------------------------------------- Summary of changes: ctdb/server/ctdb_takeover.c | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) Changeset truncated at 500 lines: diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index ee4dbe1..ff096ce 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -434,12 +434,6 @@ static int32_t ctdb_announce_vnn_iface(struct ctdb_context *ctdb, return 0; } -struct takeover_callback_state { - struct ctdb_req_control_old *c; - ctdb_sock_addr *addr; - struct ctdb_vnn *vnn; -}; - struct ctdb_do_takeip_state { struct ctdb_req_control_old *c; struct ctdb_vnn *vnn; @@ -872,14 +866,21 @@ static struct ctdb_vnn *release_ip_post(struct ctdb_context *ctdb, return vnn; } +struct release_ip_callback_state { + struct ctdb_req_control_old *c; + ctdb_sock_addr *addr; + struct ctdb_vnn *vnn; + uint32_t target_pnn; +}; + /* called when releaseip event finishes */ -static void release_ip_callback(struct ctdb_context *ctdb, int status, +static void release_ip_callback(struct ctdb_context *ctdb, int status, void *private_data) { - struct takeover_callback_state *state = - talloc_get_type(private_data, struct takeover_callback_state); + struct release_ip_callback_state *state = + talloc_get_type(private_data, struct release_ip_callback_state); if (status == -ETIME) { ctdb_ban_self(ctdb); @@ -897,6 +898,7 @@ static void release_ip_callback(struct ctdb_context *ctdb, int status, } } + state->vnn->pnn = state->target_pnn; state->vnn = release_ip_post(ctdb, state->vnn, state->addr); /* the control succeeded */ @@ -904,7 +906,7 @@ static void release_ip_callback(struct ctdb_context *ctdb, int status, talloc_free(state); } -static int ctdb_releaseip_destructor(struct takeover_callback_state *state) +static int ctdb_releaseip_destructor(struct release_ip_callback_state *state) { if (state->vnn != NULL) { state->vnn->update_in_flight = false; @@ -921,7 +923,7 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb, bool *async_reply) { int ret; - struct takeover_callback_state *state; + struct release_ip_callback_state *state; struct ctdb_public_ip *pip = (struct ctdb_public_ip *)indata.dptr; struct ctdb_vnn *vnn; char *iface; @@ -933,16 +935,20 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb, ctdb_addr_to_str(&pip->addr))); return 0; } - vnn->pnn = pip->pnn; /* stop any previous arps */ talloc_free(vnn->takeover_ctx); vnn->takeover_ctx = NULL; - /* Some ctdb tool commands (e.g. moveip) send - * lazy multicast to drop an IP from any node that isn't the - * intended new node. The following causes makes ctdbd ignore - * a release for any address it doesn't host. + /* RELEASE_IP controls are sent to all nodes that should not + * be hosting a particular IP. This serves 2 purposes. The + * first is to help resolve any inconsistencies. If a node + * does unexpectly host an IP then it will be released. The + * 2nd is to use a "redundant release" to tell non-takeover + * nodes where an IP is moving to. This is how "ctdb ip" can + * report the (likely) location of an IP by only asking the + * local node. Redundant releases need to update the PNN but + * are otherwise ignored. */ if (ctdb->tunable.disable_ip_failover == 0 && ctdb->do_checkpublicip) { if (!ctdb_sys_have_ip(&pip->addr)) { @@ -950,6 +956,7 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb, ctdb_addr_to_str(&pip->addr), vnn->public_netmask_bits, ctdb_vnn_iface_string(vnn))); + vnn->pnn = pip->pnn; ctdb_vnn_unassign_iface(ctdb, vnn); return 0; } @@ -958,6 +965,7 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb, DEBUG(DEBUG_DEBUG,("Redundant release of IP %s/%u (ip not held)\n", ctdb_addr_to_str(&pip->addr), vnn->public_netmask_bits)); + vnn->pnn = pip->pnn; return 0; } } @@ -983,7 +991,7 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb, iface, pip->pnn)); - state = talloc(ctdb, struct takeover_callback_state); + state = talloc(ctdb, struct release_ip_callback_state); if (state == NULL) { ctdb_set_error(ctdb, "Out of memory at %s:%d", __FILE__, __LINE__); @@ -1001,6 +1009,7 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb, return -1; } *state->addr = pip->addr; + state->target_pnn = pip->pnn; state->vnn = vnn; vnn->update_in_flight = true; -- Samba Shared Repository