diff options
| author | Martin Schwenke <martin@meltin.net> | 2014-03-28 16:18:17 +1100 |
|---|---|---|
| committer | Amitay Isaacs <amitay@samba.org> | 2014-05-05 06:20:38 +0200 |
| commit | cbd6beb469c63749d68e6fa52b101c19ee75314f (patch) | |
| tree | bf4be7fb266022a3ee63e439910160ffd246f6af | |
| parent | 151b02cd9e05b120cc88086cfa0be6eaad04f736 (diff) | |
| download | samba-cbd6beb469c63749d68e6fa52b101c19ee75314f.tar.gz samba-cbd6beb469c63749d68e6fa52b101c19ee75314f.tar.xz samba-cbd6beb469c63749d68e6fa52b101c19ee75314f.zip | |
ctdb-daemon: Move a ZERO_STRUCT() to a better place
It might as well be near where it is used. Add a comment explaining
it.
Also add/update comments at the top of the RELEASE_IP and TAKEOVER_IP
loops to explain what is happening.
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): Mon May 5 06:20:39 CEST 2014 on sn-devel-104
| -rw-r--r-- | ctdb/server/ctdb_takeover.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index 14049545db..6c21e2bb6a 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -2691,8 +2691,6 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap, return -1; } - ZERO_STRUCT(ip); - /* Do the IP reassignment calculations */ ctdb_takeover_run_core(ctdb, ipflags, &all_ips, force_rebalance_nodes); @@ -2716,6 +2714,14 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap, async_data->fail_callback = takeover_run_fail_callback; async_data->callback_data = takeover_data; + ZERO_STRUCT(ip); /* Avoid valgrind warnings for union */ + + /* Send a RELEASE_IP to all nodes that should not be hosting + * each IP. For each IP, all but one of these will be + * redundant. However, the redundant ones are used to tell + * nodes which node should be hosting the IP so that commands + * like "ctdb ip" can display a particular nodes idea of who + * is hosting what. */ for (i=0;i<nodemap->num;i++) { /* don't talk to unconnected nodes, but do talk to banned nodes */ if (nodemap->nodes[i].flags & NODE_FLAGS_DISCONNECTED) { @@ -2770,7 +2776,10 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap, talloc_free(async_data); - /* tell all nodes to get their own IPs */ + /* For each IP, send a TAKOVER_IP to the node that should be + * hosting it. Many of these will often be redundant (since + * the allocation won't have changed) but they can be useful + * to recover from inconsistencies. */ async_data = talloc_zero(tmp_ctx, struct client_async_data); CTDB_NO_MEMORY_FATAL(ctdb, async_data); |
