1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

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
This commit is contained in:
Martin Schwenke 2014-03-28 16:18:17 +11:00 committed by Amitay Isaacs
parent 151b02cd9e
commit cbd6beb469

View File

@ -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);