[2/2] parallels: relax check for auto switch of prealloc_mode
diff mbox

Message ID 1491405126-30591-3-git-send-email-den@openvz.org
State New
Headers show

Commit Message

Denis V. Lunev April 5, 2017, 3:12 p.m. UTC
PRL_PREALLOC_MODE_TRUNCATE can be set only through command line. Remove
the check that bdrv_truncate() is working on, this is almost always the
case, while the check could lead to serious consequences during migration
etc when we should not even try to API which technically could change the
image (asserts are possible).

Let us keep this simple.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/parallels.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Stefan Hajnoczi April 6, 2017, 3:59 p.m. UTC | #1
On Wed, Apr 05, 2017 at 06:12:06PM +0300, Denis V. Lunev wrote:
> PRL_PREALLOC_MODE_TRUNCATE can be set only through command line. Remove
> the check that bdrv_truncate() is working on, this is almost always the
> case, while the check could lead to serious consequences during migration
> etc when we should not even try to API which technically could change the
> image (asserts are possible).
> 
> Let us keep this simple.
> 
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  block/parallels.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

Patch
diff mbox

diff --git a/block/parallels.c b/block/parallels.c
index 9dea09e..e805034 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -695,8 +695,7 @@  static int parallels_open(BlockDriverState *bs, QDict *options, int flags,
         goto fail_options;
     }
 
-    if (!(flags & BDRV_O_RESIZE) || !bdrv_has_zero_init(bs->file->bs) ||
-            bdrv_truncate(bs->file, bdrv_getlength(bs->file->bs)) != 0) {
+    if (!bdrv_has_zero_init(bs->file->bs) != 0) {
         s->prealloc_mode = PRL_PREALLOC_MODE_FALLOCATE;
     }