]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-recoverd: Correctly find nodemap entry for pnn
authorMartin Schwenke <martin@meltin.net>
Tue, 14 Jul 2020 04:22:15 +0000 (14:22 +1000)
committerKarolin Seeger <kseeger@samba.org>
Tue, 25 Aug 2020 13:57:28 +0000 (13:57 +0000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 3654e416770cc7521dcc3c15976daeba37023304)

ctdb/server/ctdb_recoverd.c

index 049b684171461b8955122e20219706f06bc374d4..a480f7fa90edbc4c0506ace15b32a76c31bc1e7b 100644 (file)
@@ -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;