summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2018-01-18 19:52:22 +1100
committerKarolin Seeger <kseeger@samba.org>2020-08-25 11:27:18 +0000
commitdb34c22ab12e3abc8e29029205ffd8940577f9bd (patch)
treec207425083af3fa68101f1d261acbda17511d6d8 /ctdb
parentd360401282d4127b466c79cf024d4c02cd70921f (diff)
downloadsamba-db34c22ab12e3abc8e29029205ffd8940577f9bd.tar.gz
ctdb-recoverd: Add an intermediate state struct for nodemap fetching
This will allow an error callback to be added. 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> (cherry picked from commit a079ee31690cf7110f46b41989ffcfb83b7626d6)
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/server/ctdb_recoverd.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index c6254ae3404..406f870afc8 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -2223,13 +2223,19 @@ done:
}
+struct remote_nodemaps_state {
+ struct ctdb_node_map_old **remote_nodemaps;
+};
+
static void async_getnodemap_callback(struct ctdb_context *ctdb,
uint32_t node_pnn,
int32_t res,
TDB_DATA outdata,
void *callback_data)
{
- struct ctdb_node_map_old **remote_nodemaps = callback_data;
+ struct remote_nodemaps_state *state =
+ (struct remote_nodemaps_state *)callback_data;
+ struct ctdb_node_map_old **remote_nodemaps = state->remote_nodemaps;
if (node_pnn >= ctdb->num_nodes) {
DBG_ERR("Invalid PNN\n");
@@ -2248,6 +2254,7 @@ static int get_remote_nodemaps(struct ctdb_recoverd *rec,
struct ctdb_context *ctdb = rec->ctdb;
struct ctdb_node_map_old **t;
uint32_t *nodes;
+ struct remote_nodemaps_state state;
int ret;
t = talloc_zero_array(mem_ctx,
@@ -2260,6 +2267,8 @@ static int get_remote_nodemaps(struct ctdb_recoverd *rec,
nodes = list_of_active_nodes(ctdb, rec->nodemap, mem_ctx, true);
+ state.remote_nodemaps = t;
+
ret = ctdb_client_async_control(ctdb,
CTDB_CONTROL_GET_NODEMAP,
nodes,
@@ -2269,7 +2278,7 @@ static int get_remote_nodemaps(struct ctdb_recoverd *rec,
tdb_null,
async_getnodemap_callback,
NULL,
- t);
+ &state);
talloc_free(nodes);
if (ret != 0) {