[Sheepdog] [PATCH] sheep: get vdi bitmap correctly in join phase
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Tue Sep 13 02:05:40 CEST 2011
At Sun, 11 Sep 2011 00:49:20 +0800,
Liu Yuan wrote:
>
> From: Liu Yuan <tailai.ly at taobao.com>
>
> After the new node joins, command *collie-vdi-list*
> cannot list any vdi information, that are created
> before this node is joined. This is because in the
> join phase, get_vdi_bitmap_from_all() cannot get corret
> vdi bitmap *if* there is no node in sd_node_list.
> This patch moves this function after the function
> which updates the sd_node_list.
>
> With this patch, collie-vdi-list works as expected in
> newly added nodes.
>
> Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
> ---
> sheep/group.c | 13 ++-----------
> 1 files changed, 2 insertions(+), 11 deletions(-)
>
> diff --git a/sheep/group.c b/sheep/group.c
> index eb0c4e2..22c4f66 100644
> --- a/sheep/group.c
> +++ b/sheep/group.c
> @@ -863,17 +863,6 @@ static void __sd_deliver(struct cpg_event *cevent)
> break;
> }
> }
> -
> - if (m->state == DM_FIN) {
> - switch (m->op) {
> - case SD_MSG_JOIN:
> - if (((struct join_message *)m)->cluster_status == SD_STATUS_OK)
> - if (sys->status != SD_STATUS_OK)
> - get_vdi_bitmap_from_all();
> - break;
> - }
> - }
> -
> }
>
> static void send_join_response(struct work_deliver *w)
> @@ -902,6 +891,8 @@ static void __sd_deliver_done(struct cpg_event *cevent)
> switch (m->op) {
> case SD_MSG_JOIN:
> update_cluster_info((struct join_message *)m);
> + if (((struct join_message *)m)->cluster_status == SD_STATUS_OK)
> + get_vdi_bitmap_from_all();
> break;
> case SD_MSG_LEAVE:
> node = find_node(&sys->sd_node_list, m->nodeid, m->pid);
Thanks for your contribution, but this doesn't work.
We cannot sleep in __sd_deliver_done (the main thread), so we cannot
call get_vdi_bitmap_from_all() in it; if all the sheep daemons call
get_vdi_bitmap_from_all() at the same time, the cluster will stuck.
I think the right way is doing the followings in __sd_deliver (the
worker thread):
- call get_vdi_bitmap_from_all()
- extract a new node from join_message, and get a vdi bitmap from the node
Thanks,
Kazutaka
More information about the sheepdog
mailing list