提交 e3e0003a 编写于 作者: M Max Reitz 提交者: Peter Maydell

block/io: Comment out permission assertions

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: NKevin Wolf <kwolf@redhat.com>
Signed-off-by: NMax Reitz <mreitz@redhat.com>
Reviewed-by: NKevin Wolf <kwolf@redhat.com>
Tested-by: NKevin Wolf <kwolf@redhat.com>
Message-id: 20170411145050.31290-1-mreitz@redhat.com
Tested-by: NLaurent Vivier <lvivier@redhat.com>
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
上级 5eceb01a
...@@ -3274,7 +3274,11 @@ int bdrv_truncate(BdrvChild *child, int64_t offset) ...@@ -3274,7 +3274,11 @@ int bdrv_truncate(BdrvChild *child, int64_t offset)
BlockDriver *drv = bs->drv; BlockDriver *drv = bs->drv;
int ret; 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) if (!drv)
return -ENOMEDIUM; return -ENOMEDIUM;
......
...@@ -1345,8 +1345,16 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child, ...@@ -1345,8 +1345,16 @@ static int coroutine_fn bdrv_aligned_pwritev(BdrvChild *child,
assert(!waited || !req->serialising); assert(!waited || !req->serialising);
assert(req->overlap_offset <= offset); assert(req->overlap_offset <= offset);
assert(offset + bytes <= req->overlap_offset + req->overlap_bytes); assert(offset + bytes <= req->overlap_offset + req->overlap_bytes);
assert(child->perm & BLK_PERM_WRITE); /* FIXME: Block migration uses the BlockBackend of the guest device at a
assert(end_sector <= bs->total_sectors || child->perm & BLK_PERM_RESIZE); * 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); ret = notifier_with_return_list_notify(&bs->before_write_notifiers, req);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册