All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH RFC] block: Tolerate existing writers on read only BdrvChild
@ 2017-03-01  8:15 Fam Zheng
  2017-03-01  9:49 ` Kevin Wolf
  0 siblings, 1 reply; 9+ messages in thread
From: Fam Zheng @ 2017-03-01  8:15 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, Max Reitz, qemu-block

In an ideal world, read-write access to an image is inherently
exclusive, because we cannot guarantee other readers and writers a
consistency view of the whole image at all point. That's what the
current permission system does, and it is okay as long as it is entirely
internal. But that would change with the coming image locking. In
practice, both end users and our test cases use tools like qemu-img and
qemu-io to peek at images while guest is running.

Relax a bit and accept other writers in this case.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block.c b/block.c
index f293ccb..9bdd77c 100644
--- a/block.c
+++ b/block.c
@@ -1685,12 +1685,12 @@ void bdrv_format_default_perms(BlockDriverState *bs, BdrvChild *c,
         /* Format drivers may touch metadata even if the guest doesn't write */
         if (!bdrv_is_read_only(bs)) {
             perm |= BLK_PERM_WRITE | BLK_PERM_RESIZE;
+            shared &= ~(BLK_PERM_WRITE | BLK_PERM_RESIZE);
         }
 
         /* bs->file always needs to be consistent because of the metadata. We
          * can never allow other users to resize or write to it. */
         perm |= BLK_PERM_CONSISTENT_READ;
-        shared &= ~(BLK_PERM_WRITE | BLK_PERM_RESIZE);
     } else {
         /* We want consistent read from backing files if the parent needs it.
          * No other operations are performed on backing files. */
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-03-03  1:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-01  8:15 [Qemu-devel] [PATCH RFC] block: Tolerate existing writers on read only BdrvChild Fam Zheng
2017-03-01  9:49 ` Kevin Wolf
2017-03-01 12:39   ` Fam Zheng
2017-03-01 15:16     ` Kevin Wolf
2017-03-01 16:10       ` Fam Zheng
2017-03-01 16:22         ` Kevin Wolf
2017-03-02 11:21           ` Fam Zheng
2017-03-02 14:23             ` Kevin Wolf
2017-03-03  1:46               ` Fam Zheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.