[sheepdog] [PATCH] sheep/gateway: fix a PANIC by wrong passing policy

Robin Dong robin.k.dong at gmail.com
Fri Dec 27 02:52:27 CET 2013


Reviewed-by: Robin Dong <sanbai at taobao.com>


2013/12/26 Liu Yuan <namei.unix at gmail.com>

> We should use get_vdi_copy_policy() to get the policy if
> req->rq.obj.policy == 0
> or we will panic the sheep daemon
>
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  sheep/gateway.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/sheep/gateway.c b/sheep/gateway.c
> index c8a1e9d..f0f716a 100644
> --- a/sheep/gateway.c
> +++ b/sheep/gateway.c
> @@ -518,9 +518,11 @@ static int gateway_forward_request(struct request
> *req)
>          */
>         nr_reqs = nr_to_send;
>         if (nr_to_send > nr_copies) {
> +               uint8_t policy = req->rq.obj.copy_policy ?:
> +                       get_vdi_copy_policy(oid_to_vid(req->rq.obj.oid));
>                 int ds;
>                 /* Only for erasure code, nr_to_send might > nr_copies */
> -               ec_policy_to_dp(req->rq.obj.copy_policy, &ds, NULL);
> +               ec_policy_to_dp(policy, &ds, NULL);
>                 if (nr_copies < ds) {
>                         sd_err("There isn't enough copies(%d) to send out
> (%d)",
>                                nr_copies, nr_to_send);
> --
> 1.8.1.2
>
> --
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog
>



-- 
--
Best Regard
Robin Dong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/sheepdog/attachments/20131227/8a29dff1/attachment-0004.html>


More information about the sheepdog mailing list