From 4d1f3acc9413bb2fbfbaa967499ba4e67de1fc04 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Mon, 16 Jul 2007 08:36:09 +1000 Subject: [PATCH] add a check if start_node is beyond the end of the nodemap and reset it back to 0 if it is to prevent an infinite loop. this could happen if in the future we add a mechanism to add/remove nodes to a cluster at runtime (This used to be ctdb commit 217e80a468713fec86ccb0608460e3401046bb98) --- ctdb/server/ctdb_takeover.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index 56589d90ea5..76f87691e08 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -457,6 +457,14 @@ static void ctdb_takeover_find_node(struct ctdb_context *ctdb, struct ctdb_node_ static int start_node=0; int j; + /* If we add facilities to add/remove nodes to a cluster at runtime + we must make sure that start_node is suddently not beyond the + end of the nodelist + */ + if (start_node >= nodemap->num) { + start_node = 0; + } + j=start_node; while (1) { if (!(nodemap->nodes[j].flags & mask_flags) && -- 2.47.3