From: levin li <[email protected]> When sheep starts as a gateway-only node firstly in the cluster, there's no non-gateway-only nodes and thus nr_non_gateway_nodes is zero, and it casues to divide zero which causes gateway-only node crash
Signed-off-by: levin li <[email protected]> --- sheep/group.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sheep/group.c b/sheep/group.c index 8ebb3e6..05ffb3e 100644 --- a/sheep/group.c +++ b/sheep/group.c @@ -797,6 +797,10 @@ void recalculate_vnodes(struct sd_node *nodes, int nr_nodes) nr_non_gateway_nodes++; } } + + if (!nr_non_gateway_nodes) + return; + avg_size /= nr_non_gateway_nodes; for (i = 0; i < nr_nodes; i++) { -- 1.7.10 -- sheepdog mailing list [email protected] http://lists.wpkg.org/mailman/listinfo/sheepdog
