Blame 0001-block-Don-t-check-permissions-for-copy-on-read.patch

5dd6a7
From 1bf03e66fd03af46ff0f98dd04b6e28f432ac1e3 Mon Sep 17 00:00:00 2001
5dd6a7
From: Kevin Wolf <kwolf@redhat.com>
5dd6a7
Date: Fri, 7 Apr 2017 12:29:05 +0200
5dd6a7
Subject: [PATCH] block: Don't check permissions for copy on read
5dd6a7
5dd6a7
The assertion is currently failing. We can't require callers to have
5dd6a7
write permissions when all they are doing is a read, so comment it out.
5dd6a7
Add a FIXME comment in the code so that the check is re-enabled when
5dd6a7
copy on read is refactored into its own filter driver.
5dd6a7
5dd6a7
Reported-by: Richard W.M. Jones <rjones@redhat.com>
5dd6a7
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5dd6a7
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
5dd6a7
---
5dd6a7
 block/io.c | 9 ++++++++-
5dd6a7
 1 file changed, 8 insertions(+), 1 deletion(-)
5dd6a7
5dd6a7
diff --git a/block/io.c b/block/io.c
5dd6a7
index 2709a7007f..7321ddab3d 100644
5dd6a7
--- a/block/io.c
5dd6a7
+++ b/block/io.c
5dd6a7
@@ -945,7 +945,14 @@ static int coroutine_fn bdrv_co_do_copy_on_readv(BdrvChild *child,
5dd6a7
     size_t skip_bytes;
5dd6a7
     int ret;
5dd6a7
 
5dd6a7
-    assert(child->perm & (BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE));
5dd6a7
+    /* FIXME We cannot require callers to have write permissions when all they
5dd6a7
+     * are doing is a read request. If we did things right, write permissions
5dd6a7
+     * would be obtained anyway, but internally by the copy-on-read code. As
5dd6a7
+     * long as it is implemented here rather than in a separat filter driver,
5dd6a7
+     * the copy-on-read code doesn't have its own BdrvChild, however, for which
5dd6a7
+     * it could request permissions. Therefore we have to bypass the permission
5dd6a7
+     * system for the moment. */
5dd6a7
+    // assert(child->perm & (BLK_PERM_WRITE_UNCHANGED | BLK_PERM_WRITE));
5dd6a7
 
5dd6a7
     /* Cover entire cluster so no additional backing file I/O is required when
5dd6a7
      * allocating cluster in the image file.
5dd6a7
-- 
5dd6a7
2.12.0
5dd6a7