mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
ctdb-recoverd: Change update_local_flags() to use already retrieved nodemaps
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
910a0b3b74
commit
702c7c4934
@ -537,18 +537,19 @@ static void ctdb_wait_election(struct ctdb_recoverd *rec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Update our local flags from all remote connected nodes.
|
* Update local flags from all remote connected nodes and push out
|
||||||
This is only run when we are or we belive we are the recovery master
|
* flags changes to all nodes. This is only run by the recovery
|
||||||
|
* master.
|
||||||
*/
|
*/
|
||||||
static int update_local_flags(struct ctdb_recoverd *rec, struct ctdb_node_map_old *nodemap)
|
static int update_local_flags(struct ctdb_recoverd *rec,
|
||||||
|
struct ctdb_node_map_old *nodemap,
|
||||||
|
struct ctdb_node_map_old **remote_nodemaps)
|
||||||
{
|
{
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
struct ctdb_context *ctdb = rec->ctdb;
|
struct ctdb_context *ctdb = rec->ctdb;
|
||||||
TALLOC_CTX *mem_ctx = talloc_new(ctdb);
|
TALLOC_CTX *mem_ctx = talloc_new(ctdb);
|
||||||
|
|
||||||
/* get the nodemap for all active remote nodes and verify
|
/* Check flags from remote nodes */
|
||||||
they are the same as for this node
|
|
||||||
*/
|
|
||||||
for (j=0; j<nodemap->num; j++) {
|
for (j=0; j<nodemap->num; j++) {
|
||||||
struct ctdb_node_map_old *remote_nodemap=NULL;
|
struct ctdb_node_map_old *remote_nodemap=NULL;
|
||||||
uint32_t local_flags = nodemap->nodes[j].flags;
|
uint32_t local_flags = nodemap->nodes[j].flags;
|
||||||
@ -562,15 +563,7 @@ static int update_local_flags(struct ctdb_recoverd *rec, struct ctdb_node_map_ol
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), nodemap->nodes[j].pnn,
|
remote_nodemap = remote_nodemaps[j];
|
||||||
mem_ctx, &remote_nodemap);
|
|
||||||
if (ret != 0) {
|
|
||||||
DEBUG(DEBUG_ERR, (__location__ " Unable to get nodemap from remote node %u\n",
|
|
||||||
nodemap->nodes[j].pnn));
|
|
||||||
ctdb_set_culprit(rec, nodemap->nodes[j].pnn);
|
|
||||||
talloc_free(mem_ctx);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
remote_flags = remote_nodemap->nodes[j].flags;
|
remote_flags = remote_nodemap->nodes[j].flags;
|
||||||
|
|
||||||
if (local_flags != remote_flags) {
|
if (local_flags != remote_flags) {
|
||||||
@ -595,7 +588,6 @@ static int update_local_flags(struct ctdb_recoverd *rec, struct ctdb_node_map_ol
|
|||||||
local_flags);
|
local_flags);
|
||||||
nodemap->nodes[j].flags = remote_flags;
|
nodemap->nodes[j].flags = remote_flags;
|
||||||
}
|
}
|
||||||
talloc_free(remote_nodemap);
|
|
||||||
}
|
}
|
||||||
talloc_free(mem_ctx);
|
talloc_free(mem_ctx);
|
||||||
return 0;
|
return 0;
|
||||||
@ -2563,7 +2555,7 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ensure our local copies of flags are right */
|
/* ensure our local copies of flags are right */
|
||||||
ret = update_local_flags(rec, nodemap);
|
ret = update_local_flags(rec, nodemap, remote_nodemaps);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
DEBUG(DEBUG_ERR,("Unable to update local flags\n"));
|
DEBUG(DEBUG_ERR,("Unable to update local flags\n"));
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user