At Thu, 10 Jul 2014 14:29:39 +0800,
Ruoyu wrote:
> 
> For fear that req->data is not allocated successfully, move
> increament of cluster info refcnt after memory alloc is reasonable.
> 
> Signed-off-by: Ruoyu <[email protected]>
> ---
>  sheep/request.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)

Applied, with typo fix, thanks.
Hitoshi

> 
> diff --git a/sheep/request.c b/sheep/request.c
> index f2ccff6..eb72b00 100644
> --- a/sheep/request.c
> +++ b/sheep/request.c
> @@ -687,8 +687,6 @@ static struct request *alloc_request(struct client_info 
> *ci, int data_length)
>       if (!req)
>               return NULL;
>  
> -     req->ci = ci;
> -     refcount_inc(&ci->refcnt);
>       if (data_length) {
>               req->data_length = data_length;
>               req->data = valloc(data_length);
> @@ -698,6 +696,9 @@ static struct request *alloc_request(struct client_info 
> *ci, int data_length)
>               }
>       }
>  
> +     req->ci = ci;
> +     refcount_inc(&ci->refcnt);
> +
>       refcount_set(&req->refcnt, 1);
>  
>       uatomic_inc(&sys->nr_outstanding_reqs);
> -- 
> 1.8.3.2
> 
> 
> -- 
> sheepdog mailing list
> [email protected]
> http://lists.wpkg.org/mailman/listinfo/sheepdog
-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to