[Sheepdog] [PATCH] sheep: get max_logs right in cluster_queue_request()

MORITA Kazutaka morita.kazutaka at lab.ntt.co.jp
Sat Sep 17 19:42:29 CEST 2011


At Sun, 18 Sep 2011 00:56:39 +0800,
Liu Yuan wrote:
> 
> From: Liu Yuan <tailai.ly at taobao.com>
> 
> The calculation for max_logs is wrong and this would result in Segmentatoin Fault
> when querying cluster epoch information by 'collie cluster info'
> 
> Reported-by: Shawn Moore <smmoore at gmail.com>
> Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
> ---
>  sheep/group.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Thanks.  This patch is almost same with
http://lists.wpkg.org/pipermail/sheepdog/2011-September/001365.html,
but I'll pick your one because the commit message is not written in
mine.

Thanks,

Kazutaka


> 
> diff --git a/sheep/group.c b/sheep/group.c
> index ee12cf3..9af64b6 100644
> --- a/sheep/group.c
> +++ b/sheep/group.c
> @@ -266,7 +266,7 @@ void cluster_queue_request(struct work *work, int idx)
>  			      (struct sd_node_rsp *)rsp, req->data);
>  		break;
>  	case SD_OP_STAT_CLUSTER:
> -		max_logs = rsp->data_length / sizeof(log->nodes[0]);
> +		max_logs = rsp->data_length / sizeof(*log);
>  		epoch = get_latest_epoch();
>  		rsp->data_length = 0;
>  		for (i = 0; i < max_logs; i++) {
> -- 
> 1.7.5.1
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list