daemon take a shortcut in all_nodes_are_disabled()
authorGregor Beck <gbeck@sernet.de>
Mon, 31 Mar 2014 05:50:45 +0000 (07:50 +0200)
committerMartin Schwenke <martin@meltin.net>
Wed, 24 Feb 2016 05:57:42 +0000 (16:57 +1100)
Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
(Imported from commit dd56afc7df1149e809486bc0f1c336a42bc7c0aa)

server/ctdb_takeover.c

index 3c89b8a56c91a221dd340b84dd9832d6773c4de4..d7f794b8981cf5b8430fffd9fe207377bde64823 100644 (file)
@@ -2181,17 +2181,16 @@ finished:
 
 static bool all_nodes_are_disabled(struct ctdb_node_map *nodemap)
 {
-       int i, num_healthy;
+       int i;
 
-       /* Count how many completely healthy nodes we have */
-       num_healthy = 0;
        for (i=0;i<nodemap->num;i++) {
                if (!(nodemap->nodes[i].flags & (NODE_FLAGS_INACTIVE|NODE_FLAGS_DISABLED))) {
-                       num_healthy++;
+                       /* Found one completely healthy node */
+                       return false;
                }
        }
 
-       return num_healthy == 0;
+       return true;
 }
 
 /* The calculation part of the IP allocation algorithm. */