]> Git Repo - qemu.git/commitdiff
block/io: Comment out permission assertions
authorMax Reitz <[email protected]>
Tue, 11 Apr 2017 14:50:50 +0000 (16:50 +0200)
committerPeter Maydell <[email protected]>
Tue, 11 Apr 2017 15:09:31 +0000 (16:09 +0100)
In case of block migration, there may be writes to BlockBackends that do
not have the write permission taken. Before this issue is fixed (which
is not going to happen in 2.9), we therefore cannot assert that this is
the case.

Suggested-by: Kevin Wolf <[email protected]>
Signed-off-by: Max Reitz <[email protected]>
Reviewed-by: Kevin Wolf <[email protected]>
Tested-by: Kevin Wolf <[email protected]>
Message-id: 20170411145050[email protected]
Tested-by: Laurent Vivier <[email protected]>
Signed-off-by: Peter Maydell <[email protected]>
block.c
block/io.c

diff --git a/block.c b/block.c
index 086a12df97115379d5d191509176455a13bd2c76..1fbbb8d606057f0fb595df7e46a313d4c10a846e 100644 (file)
--- a/block.c
+++ b/block.c
@@ -3274,7 +3274,11 @@ int bdrv_truncate(BdrvChild *child, int64_t offset)
     BlockDriver *drv = bs->drv;
     int ret;
 
-    assert(child->perm & BLK_PERM_RESIZE);
+    /* FIXME: Some format block drivers use this function instead of implicitly
+     *        growing their file by writing beyond its end.
+     *        See bdrv_aligned_pwritev() for an explanation why we currently
+     *        cannot assert this permission in that case. */
+    // assert(child->perm & BLK_PERM_RESIZE);
 
     if (!drv)
         return -ENOMEDIUM;
index bae6947032f3339b8f04d645a490e04e7cc39ef8..8706bfa5782db3162f9f49c44ab5a63d8502b251 100644 (file)
@@ -1345,8 +1345,16 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child,
     assert(!waited || !req->serialising);
     assert(req->overlap_offset <= offset);
     assert(offset + bytes <= req->overlap_offset + req->overlap_bytes);
-    assert(child->perm & BLK_PERM_WRITE);
-    assert(end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE);
+    /* FIXME: Block migration uses the BlockBackend of the guest device at a
+     *        point when it has not yet taken write permissions. This will be
+     *        fixed by a future patch, but for now we have to bypass this
+     *        assertion for block migration to work. */
+    // assert(child->perm & BLK_PERM_WRITE);
+    /* FIXME: Because of the above, we also cannot guarantee that all format
+     *        BDS take the BLK_PERM_RESIZE permission on their file BDS, since
+     *        they are not obligated to do so if they do not have any parent
+     *        that has taken the permission to write to them. */
+    // assert(end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE);
 
     ret = notifier_with_return_list_notify(&bs->before_write_notifiers, req);
 
This page took 0.028955 seconds and 4 git commands to generate.