[sheepdog] [PATCH] dog: fix invalid argument for ec_decode_buffer

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Wed Feb 25 03:28:59 CET 2015


At Mon, 23 Feb 2015 10:36:46 +0900,
Teruaki Ishizaki wrote:
> 
> This patch change invalid argument of ec_decode_buffer()
> from block_size_shift to object_size.
> 
> Signed-off-by: Teruaki Ishizaki <ishizaki.teruaki at lab.ntt.co.jp>
> ---
>  dog/vdi.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)

Applied, thanks.
Hitoshi

> 
> diff --git a/dog/vdi.c b/dog/vdi.c
> index f1ebd45..15a382a 100644
> --- a/dog/vdi.c
> +++ b/dog/vdi.c
> @@ -1973,6 +1973,7 @@ static void check_erasure_object(struct vdi_check_info *info)
>  	struct fec *ctx = ec_init(d, dp);
>  	int miss_idx[dp], input_idx[dp];
>  	uint64_t oid = info->oid;
> +	uint32_t object_size = (UINT32_C(1) << info->block_size_shift);
>  	size_t len = get_store_objsize(info->copy_policy,
>  				       info->block_size_shift, oid);
>  	char *obj = xmalloc(len);
> @@ -2001,7 +2002,7 @@ static void check_erasure_object(struct vdi_check_info *info)
>  			for (j = 0; j < d; j++)
>  				ds[j] = info->vcw[j].buf;
>  			ec_decode_buffer(ctx, ds, idx, obj, d + k,
> -					 info->block_size_shift);
> +					 object_size);
>  			if (memcmp(obj, info->vcw[d + k].buf, len) != 0) {
>  				/* TODO repair the inconsistency */
>  				sd_err("object %"PRIx64" is inconsistent", oid);
> @@ -2020,7 +2021,7 @@ static void check_erasure_object(struct vdi_check_info *info)
>  			for (i = 0; i < d; i++)
>  				ds[i] = input[i];
>  			ec_decode_buffer(ctx, ds, input_idx, obj, m,
> -					 info->block_size_shift);
> +					 object_size);
>  			write_object_to(info->vcw[m].vnode, oid, obj,
>  					len, true, info->vcw[m].ec_index);
>  			fprintf(stdout, "fixed missing %"PRIx64", "
> -- 
> 1.7.1
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> https://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list