]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
add a check if start_node is beyond the end of the nodemap and reset it
authorRonnie Sahlberg <sahlberg@ronnie>
Sun, 15 Jul 2007 22:36:09 +0000 (08:36 +1000)
committerRonnie Sahlberg <sahlberg@ronnie>
Sun, 15 Jul 2007 22:36:09 +0000 (08:36 +1000)
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

index 56589d90ea5c826467c07d130e7859b54d37e3a0..76f87691e08484146539c98560afdfd1a4f114fd 100644 (file)
@@ -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) &&