[Devel] [PATCH rh7] ploop: release plo->ctl_mutex for thaw_bdev in PLOOP_IOC_THAW handler

Maxim Patlasov mpatlasov at virtuozzo.com
Fri Jul 15 10:58:03 PDT 2016


On 07/15/2016 01:10 AM, Vladimir Davydov wrote:
> diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
> index d52975eaaa36..3dc94ca5c393 100644
> --- a/drivers/block/ploop/dev.c
> +++ b/drivers/block/ploop/dev.c
> @@ -4839,11 +4839,12 @@ static int ploop_thaw(struct ploop_device *plo, struct block_device *bdev)
>   	if (!test_bit(PLOOP_S_FROZEN, &plo->state))
>   		return 0;
>   
> +	plo->sb = NULL;
> +	clear_bit(PLOOP_S_FROZEN, &plo->state);
> +
> +	mutex_unlock(&plo->ctl_mutex);

Since this point nothing in ploop state hints that the device is still 
frozen. Someone (another instance of backup tool?) may mistakenly try to 
freeze it again (before we call thaw_bdev) and succeed in it (because 
the S_FROZEN bit is already cleared). The result would be "double 
freeze" that we tried to avoid by initial patch. The fix must be simple, 
I'll send a patch soon.

Thanks,
Maxim

>   	err = thaw_bdev(bdev, sb);
> -	if (!err) {
> -		plo->sb = NULL;
> -		clear_bit(PLOOP_S_FROZEN, &plo->state);
> -	}
> +	mutex_lock(&plo->ctl_mutex);
>   
>   	return err;
>   }



More information about the Devel mailing list