diff options
author | Martin Schwenke <martin@meltin.net> | 2019-06-22 06:23:12 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2019-07-05 05:03:24 +0000 |
commit | 75a808fd86a58371b465332f7c9d47d2dfbcbc08 (patch) | |
tree | 706b7851ca44741db359f5743ecf2fd889df89db /ctdb | |
parent | 010c1d77cd7e192b1fff39b7b91fccbdbbf4a786 (diff) | |
download | samba-75a808fd86a58371b465332f7c9d47d2dfbcbc08.tar.gz |
ctdb-daemon: Don't index by PNN when initialising node flags
Indexing by PNN is wrong.
This also removes a signed/unsigned comparison because the PNN is not
compared to -1 anymore.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/server/ctdb_daemon.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c index e9fbc29cb98..c0553a18c14 100644 --- a/ctdb/server/ctdb_daemon.c +++ b/ctdb/server/ctdb_daemon.c @@ -1229,23 +1229,26 @@ failed: static void initialise_node_flags (struct ctdb_context *ctdb) { - if (ctdb->pnn == -1) { - ctdb_fatal(ctdb, "PNN is set to -1 (unknown value)"); + unsigned int i; + + /* Always found: PNN correctly set just before this is called */ + for (i = 0; i < ctdb->num_nodes; i++) { + if (ctdb->pnn == ctdb->nodes[i]->pnn) { + break; + } } - ctdb->nodes[ctdb->pnn]->flags &= ~NODE_FLAGS_DISCONNECTED; + ctdb->nodes[i]->flags &= ~NODE_FLAGS_DISCONNECTED; /* do we start out in DISABLED mode? */ if (ctdb->start_as_disabled != 0) { - DEBUG(DEBUG_ERR, - ("This node is configured to start in DISABLED state\n")); - ctdb->nodes[ctdb->pnn]->flags |= NODE_FLAGS_DISABLED; + D_ERR("This node is configured to start in DISABLED state\n"); + ctdb->nodes[i]->flags |= NODE_FLAGS_DISABLED; } /* do we start out in STOPPED mode? */ if (ctdb->start_as_stopped != 0) { - DEBUG(DEBUG_ERR, - ("This node is configured to start in STOPPED state\n")); - ctdb->nodes[ctdb->pnn]->flags |= NODE_FLAGS_STOPPED; + D_ERR("This node is configured to start in STOPPED state\n"); + ctdb->nodes[i]->flags |= NODE_FLAGS_STOPPED; } } |