]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-recoverd: Fix node_pnn check and assignment of nodemap into array
authorMartin Schwenke <martin@meltin.net>
Thu, 30 Jul 2020 01:57:51 +0000 (11:57 +1000)
committerKarolin Seeger <kseeger@samba.org>
Tue, 25 Aug 2020 13:57:28 +0000 (13:57 +0000)
This array is indexed by the same index as nodemap, not the PNN.

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 368c83bfe3bbfff568d14f65e7b1ffa41d5349ac)

ctdb/server/ctdb_recoverd.c

index f0c5efd5b6df659bd302782e7e68e4edf623ca4e..9fd1debbcf7be285adf562575ee040d387af1ee1 100644 (file)
@@ -2237,13 +2237,21 @@ static void async_getnodemap_callback(struct ctdb_context *ctdb,
        struct remote_nodemaps_state *state =
                (struct remote_nodemaps_state *)callback_data;
        struct ctdb_node_map_old **remote_nodemaps = state->remote_nodemaps;
+       struct ctdb_node_map_old *nodemap = state->rec->nodemap;
+       size_t i;
 
-       if (node_pnn >= ctdb->num_nodes) {
-               DBG_ERR("Invalid PNN\n");
+       for (i = 0; i < nodemap->num; i++) {
+               if (nodemap->nodes[i].pnn == node_pnn) {
+                       break;
+               }
+       }
+
+       if (i >= nodemap->num) {
+               DBG_ERR("Invalid PNN %"PRIu32"\n", node_pnn);
                return;
        }
 
-       remote_nodemaps[node_pnn] = (struct ctdb_node_map_old *)talloc_steal(
+       remote_nodemaps[i] = (struct ctdb_node_map_old *)talloc_steal(
                                        remote_nodemaps, outdata.dptr);
 
 }