1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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)
This commit is contained in:
Ronnie Sahlberg 2007-07-16 08:36:09 +10:00
parent 49f98e79fd
commit 4d1f3acc94

View 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) &&