[Devel] [PATCH rh7 1/4] fs: do not fail on double freeze bdev w/o sb

Maxim Patlasov mpatlasov at virtuozzo.com
Tue Jul 12 15:02:11 PDT 2016


Vova,


Let's keep flies and cutlets separately. It seems we can easily satisfy 
push-backup needs by implementing freeze/thaw ploop ioctls without 
tackling generic code at all, see a patch in attachment (unless I missed 
something obvious). And apart from these ploop/push-backup stuff, if you 
think your changes for freeze_bdev() and thaw_bdev() are useful, send 
them upstream, so we'll back-port them later, when they are accepted 
upstream (unless I missed some scenario for which those changes matter 
for us). In the other words, I think we have to keep our vz7 generic 
code base closer to ms, unless we have good reason to deviate.


Thanks,

Maxim


On 07/12/2016 03:04 AM, Vladimir Davydov wrote:
> It's possible to freeze a bdev which is not mounted. In this case
> freeze_bdev() only increments bd_fsfrozen_count in order to prevent the
> bdev from being mounted and does nothing else. A second freeze attempt
> on the same device is supposed to increment bd_fsfrozen_count again, but
> it results in NULL ptr dereference, because freeze_bdev() doesn't check
> the return value of get_super(). Fix that.
>
> Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
> ---
>   fs/block_dev.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/block_dev.c b/fs/block_dev.c
> index 4575c62d8b0b..325ee7161fbf 100644
> --- a/fs/block_dev.c
> +++ b/fs/block_dev.c
> @@ -227,7 +227,8 @@ struct super_block *freeze_bdev(struct block_device *bdev)
>   		 * thaw_bdev drops it.
>   		 */
>   		sb = get_super(bdev);
> -		drop_super(sb);
> +		if (sb)
> +			drop_super(sb);
>   		mutex_unlock(&bdev->bd_fsfreeze_mutex);
>   		return sb;
>   	}

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ploop-freeze-thaw-ioctls.patch
Type: text/x-patch
Size: 2832 bytes
Desc: not available
URL: <http://lists.openvz.org/pipermail/devel/attachments/20160712/0da87a6d/attachment.bin>


More information about the Devel mailing list