From d8e6304a2bda438194b685411fa0896f26c4b896 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Tue, 14 Jul 2020 14:22:15 +1000 Subject: ctdb-recoverd: Correctly find nodemap entry for pnn Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs (cherry picked from commit 3654e416770cc7521dcc3c15976daeba37023304) --- ctdb/server/ctdb_recoverd.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'ctdb') diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c index 049b6841714..a480f7fa90e 100644 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@ -438,18 +438,24 @@ static int update_flags_on_all_nodes(struct ctdb_recoverd *rec, struct ctdb_node_flag_change c; TALLOC_CTX *tmp_ctx = talloc_new(ctdb); uint32_t *nodes; + uint32_t i; int ret; nodemap = rec->nodemap; - if (pnn >= nodemap->num) { + for (i = 0; i < nodemap->num; i++) { + if (pnn == nodemap->nodes[i].pnn) { + break; + } + } + if (i >= nodemap->num) { DBG_ERR("Nodemap does not contain node %d\n", pnn); talloc_free(tmp_ctx); return -1; } c.pnn = pnn; - c.old_flags = nodemap->nodes[pnn].flags; + c.old_flags = nodemap->nodes[i].flags; c.new_flags = c.old_flags; c.new_flags |= flags; c.new_flags &= flags; -- cgit v1.2.1