From: Ronnie Sahlberg Date: Sun, 15 Jul 2007 22:36:09 +0000 (+1000) Subject: add a check if start_node is beyond the end of the nodemap and reset it X-Git-Tag: tevent-0.9.20~348^2~2450^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4d1f3acc9413bb2fbfbaa967499ba4e67de1fc04;p=thirdparty%2Fsamba.git 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) --- 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) &&