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

Liu Yuan namei.unix at gmail.com
Wed Oct 16 07:11:02 CEST 2013


On Wed, Oct 16, 2013 at 02:50:32AM +0900, MORITA Kazutaka wrote:
> 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()?

min() need typed value, I'll add MIN to accept macro.

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

Honestly, I don't know. SD_MAX_EVENT_BUF_SIZE was set in the old days, and I
just know it works for corosync.

Thanks
Yuan



More information about the sheepdog mailing list