[sheepdog] [PATCH] dog/vdi: fix panic if number of nodes less than number of copies

Hitoshi Mitake mitake.hitoshi at gmail.com
Mon Mar 2 14:00:46 CET 2015


At Mon,  2 Mar 2015 20:06:29 +0800,
Ruoyu wrote:
> 
> Signed-off-by: Ruoyu <liangry at ucweb.com>
> ---
>  dog/vdi.c | 7 +++++++
>  1 file changed, 7 insertions(+)

Applied, thanks.

Saeki-san, I think the latest problem you reported would be solved by
this patch. Could you check the issue?

https://bugs.launchpad.net/sheepdog-project/+bug/1427079

Thanks,
Hitoshi

> 
> diff --git a/dog/vdi.c b/dog/vdi.c
> index 6be3304..3a69505 100644
> --- a/dog/vdi.c
> +++ b/dog/vdi.c
> @@ -1137,6 +1137,13 @@ static void print_expected_location(uint64_t oid, int copies)
>  {
>  	const struct sd_vnode *vnodes[SD_MAX_COPIES];
>  
> +	if (sd_nodes_nr < copies) {
> +		printf("\nBecause number of nodes (%d) is less than "
> +			"number of copies (%d), the object should be located "
> +			"at every nodes.\n", sd_nodes_nr, copies);
> +		return;
> +	}
> +
>  	printf("\nAccording to sheepdog algorithm, "
>  		   "the object should be located at:\n");
>  	oid_to_vnodes(oid, &sd_vroot, copies, vnodes);
> -- 
> 1.8.3.2
> 
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> https://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list