[sheepdog] [PATCH] sheep: rework send join message for corosync and local drivers

MORITA Kazutaka morita.kazutaka at gmail.com
Tue Oct 15 19:50:32 CEST 2013


At Sun, 13 Oct 2013 19:29:12 +0800,
Liu Yuan wrote:
> 
> They can't send the whole struct cluster_info. Instead of doing tricks in
> send_join_request(), we just min(SD_MAX_EVENT_BUF_SIZE, join_msg_len) for
> corosync and local drivers.
> 
> This patch also fixes a bug that corosync can't work with node join because
> not enough buffer allocated for join message.
> 
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  sheep/cluster/corosync.c  |    7 ++++---
>  sheep/cluster/local.c     |    2 ++
>  sheep/cluster/zookeeper.c |    5 ++---
>  sheep/group.c             |    4 +---
>  4 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/sheep/cluster/corosync.c b/sheep/cluster/corosync.c
> index 45756e8..8af1efe 100644
> --- a/sheep/cluster/corosync.c
> +++ b/sheep/cluster/corosync.c
> @@ -168,9 +168,11 @@ static int send_message(enum corosync_message_type type,
>  {
>  	struct iovec iov[2];
>  	int ret, iov_cnt = 1;
> +	size_t mlen = msg_len > SD_MAX_EVENT_BUF_SIZE ?
> +		SD_MAX_EVENT_BUF_SIZE : msg_len;

Can't we use min()?

I think we need a brief explanation about why it's safe to limit the
buf_len to SD_MAX_EVENT_BUF_SIZE.

Thanks,

Kazutaka



More information about the sheepdog mailing list