[sheepdog] [PATCH] sheep/ops.c: fix problem caused by uninitialized backend storage in gateway

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Thu Dec 11 09:36:32 CET 2014


At Thu, 11 Dec 2014 16:30:58 +0800,
Jinzhi Chen wrote:
> 
> when a new gateway(never joined a cluster before) joined a existing
> clsuter. `dog vdi object location` causes the new gateway exist
> because its backend storage is not initialized.
> this patch solves this problems by checking whether a node is gateway
> in `local_oid_exist` fucntion. simple return `SD_RES_NO_OBJ` to avoid
> using uninitialized pointer.
> 
> Signed-off-by: Jinzhi Chen <nxtjinzhi at gmail.com>
> ---
>  sheep/ops.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks.
Hitoshi

> 
> diff --git a/sheep/ops.c b/sheep/ops.c
> index a617a83..44b3ed0 100644
> --- a/sheep/ops.c
> +++ b/sheep/ops.c
> @@ -1073,6 +1073,9 @@ static int local_oid_exist(struct request *req)
>  	uint64_t oid = req->rq.obj.oid;
>  	uint8_t ec_index = local_ec_index(req->vinfo, oid);
>  
> +	if (sys->this_node.nr_vnodes == 0)
> +		return SD_RES_NO_OBJ;
> +
>  	if (is_erasure_oid(oid) && ec_index == SD_MAX_COPIES)
>  		return SD_RES_NO_OBJ;
>  
> -- 
> 1.9.3 (Apple Git-50)
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list