[sheepdog] [PATCH] bs_sheepdog.c: fix pthread rwlock leak in sd_io()

Hitoshi Mitake mitake.hitoshi at gmail.com
Thu Oct 31 02:39:00 CET 2013


At Thu, 31 Oct 2013 10:31:27 +0900,
Ryusuke Konishi wrote:
> 
> The current sd_io function exits without unlocking pthread rwlock in
> the error path.  This fixes the leak bug.
> 
> Signed-off-by: Ryusuke Konishi <konishi.ryusuke at lab.ntt.co.jp>

Looks good to me, thanks.

Reviewed-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>

> ---
>  usr/bs_sheepdog.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/usr/bs_sheepdog.c b/usr/bs_sheepdog.c
> index cfe1046..8bb5c80 100644
> --- a/usr/bs_sheepdog.c
> +++ b/usr/bs_sheepdog.c
> @@ -845,7 +845,7 @@ retry:
>  
>  		if (ret) {
>  			eprintf("%lu %d\n", idx, ret);
> -			return -1;
> +			goto out;
>  		}
>  
>  done:
> @@ -856,6 +856,7 @@ done:
>  	if (need_update_inode)
>  		ret = update_inode(ai);
>  
> +out:
>  	pthread_rwlock_unlock(&ai->inode_lock);
>  
>  	return ret;
> -- 
> 1.7.9.3
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list