ctdb-recoverd: Add a helper variable
authorMartin Schwenke <martin@meltin.net>
Sun, 11 Jul 2021 10:40:10 +0000 (20:40 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 9 Sep 2021 01:46:49 +0000 (01:46 +0000)
Improves readability and simplifies subsequent changes.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14784
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_recoverd.c

index 4ba8729b50ec1e5c6debae0cca4ebe41a20efab7..9e08448603630ab4b86dd81b6e5d229659983f71 100644 (file)
@@ -553,13 +553,14 @@ static int update_flags(struct ctdb_recoverd *rec,
        for (j=0; j<nodemap->num; j++) {
                struct ctdb_node_map_old *remote_nodemap=NULL;
                uint32_t local_flags = nodemap->nodes[j].flags;
+               uint32_t remote_pnn = nodemap->nodes[j].pnn;
                uint32_t remote_flags;
                int ret;
 
                if (local_flags & NODE_FLAGS_DISCONNECTED) {
                        continue;
                }
-               if (nodemap->nodes[j].pnn == ctdb->pnn) {
+               if (remote_pnn == ctdb->pnn) {
                        continue;
                }
 
@@ -568,7 +569,7 @@ static int update_flags(struct ctdb_recoverd *rec,
 
                if (local_flags != remote_flags) {
                        ret = update_flags_on_all_nodes(rec,
-                                                       nodemap->nodes[j].pnn,
+                                                       remote_pnn,
                                                        remote_flags);
                        if (ret != 0) {
                                DBG_ERR(
@@ -583,7 +584,7 @@ static int update_flags(struct ctdb_recoverd *rec,
                         */
                        D_NOTICE("Remote node %u had flags 0x%x, "
                                 "local had 0x%x - updating local\n",
-                                nodemap->nodes[j].pnn,
+                                remote_pnn,
                                 remote_flags,
                                 local_flags);
                        nodemap->nodes[j].flags = remote_flags;