Because the cluster driver has strict message ordering the first join response must be for the node currently joining. Thus the join_finished flag is not needed and can be replaced by check if the joining node is this_node.
Signed-off-by: Christoph Hellwig <[email protected]> --- sheep/group.c | 10 +++------- sheep/sheep_priv.h | 2 -- 2 files changed, 3 insertions(+), 9 deletions(-) Index: sheepdog/sheep/group.c =================================================================== --- sheepdog.orig/sheep/group.c 2012-08-07 15:57:43.252003392 +0200 +++ sheepdog/sheep/group.c 2012-08-07 15:57:49.708670155 +0200 @@ -722,7 +722,6 @@ static struct vnode_info *alloc_old_vnod static void finish_join(struct join_message *msg, struct sd_node *joined, struct sd_node *nodes, size_t nr_nodes) { - sys->join_finished = 1; sys->epoch = msg->epoch; if (msg->cluster_status != SD_STATUS_OK) @@ -817,12 +816,11 @@ static void update_cluster_info(struct j { struct vnode_info *old_vnode_info = NULL; - eprintf("status = %d, epoch = %d, finished: %d\n", msg->cluster_status, - msg->epoch, sys->join_finished); + eprintf("status = %d, epoch = %d\n", msg->cluster_status, msg->epoch); sys->disable_recovery = msg->disable_recovery; - if (!sys->join_finished) + if (node_eq(joined, &sys->this_node)) finish_join(msg, joined, nodes, nr_nodes); if (!sys->disable_recovery) { @@ -1101,10 +1099,8 @@ void sd_join_handler(struct sd_node *joi /* Sheep needs this to identify itself as master. * Now mastership transfer is done. */ - if (!sys->join_finished) { - sys->join_finished = 1; + if (node_eq(joined, &sys->this_node)) { sys->epoch = get_latest_epoch(); - put_vnode_info(current_vnode_info); current_vnode_info = alloc_vnode_info(&sys->this_node, 1); } Index: sheepdog/sheep/sheep_priv.h =================================================================== --- sheepdog.orig/sheep/sheep_priv.h 2012-08-07 15:57:43.252003392 +0200 +++ sheepdog/sheep/sheep_priv.h 2012-08-07 15:57:49.708670155 +0200 @@ -68,8 +68,6 @@ struct cluster_info { int enable_write_cache; - /* set after finishing the JOIN procedure */ - int join_finished; struct sd_node this_node; uint32_t epoch; -- sheepdog mailing list [email protected] http://lists.wpkg.org/mailman/listinfo/sheepdog
