[Devel] [PATCH rh7 v2 1/2] ploop: drop bdev refcounter on freeze_bdev() failure

Maxim Patlasov mpatlasov at virtuozzo.com
Thu Aug 18 18:22:24 PDT 2016


Acked-by: Maxim Patlasov <mpatlasov at virtuozzo.com>


On 08/18/2016 09:51 AM, Andrey Ryabinin wrote:
> If freeze_bdev() called in find_and_freeze_bdev() fails we should
> drop a reference counter grabbed by bdget_disk() call.
>
> Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
> ---
>   drivers/block/ploop/dev.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
> index 83b0e32..453d36e 100644
> --- a/drivers/block/ploop/dev.c
> +++ b/drivers/block/ploop/dev.c
> @@ -3339,7 +3339,10 @@ static struct super_block *find_and_freeze_bdev(struct gendisk *disk,
>   		bdev = NULL;
>   	}
>   
> -	*bdev_pp = bdev;
> +	if (IS_ERR(sb))
> +		bdput(bdev);
> +	else
> +		*bdev_pp = bdev;
>   	return sb;
>   }
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/devel/attachments/20160818/a92640db/attachment.html>


More information about the Devel mailing list