summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2016-08-19 16:38:50 +1000
committerStefan Metzmacher <metze@samba.org>2016-08-24 11:42:31 +0200
commit46890c52e6e3d1e1545439972287e171249523ba (patch)
tree7c840da055cb405bfa38b9c42dce4ae4cc479457 /ctdb
parent2a9566f27f21502f93ee6f2615f5f2f0e8cd4d7f (diff)
downloadsamba-46890c52e6e3d1e1545439972287e171249523ba.tar.gz
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 <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Sun Aug 21 22:45:33 CEST 2016 on sn-devel-144 (cherry picked from commit 6dc75c7d24325d2070eb7feab5399dbfda50da96)
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/server/ctdb_takeover.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c
index 0330c28f055..cf33a772454 100644
--- a/ctdb/server/ctdb_takeover.c
+++ b/ctdb/server/ctdb_takeover.c
@@ -874,6 +874,7 @@ struct release_ip_callback_state {
struct ctdb_req_control_old *c;
ctdb_sock_addr *addr;
struct ctdb_vnn *vnn;
+ uint32_t target_pnn;
};
/*
@@ -901,6 +902,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 */
@@ -937,16 +939,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)) {
@@ -954,6 +960,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;
}
@@ -962,6 +969,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;
}
}
@@ -1005,6 +1013,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;