diff mbox

[06/14] block: Set "share-rw" flag for incoming migration

Message ID 1477928314-11184-7-git-send-email-famz@redhat.com
State New
Headers show

Commit Message

Fam Zheng Oct. 31, 2016, 3:38 p.m. UTC
In this way the source side QEMU is writing to the image. We need to
open it, so share-rw is required.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 blockdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Max Reitz Dec. 2, 2016, 1:22 a.m. UTC | #1
On 31.10.2016 16:38, Fam Zheng wrote:
> In this way the source side QEMU is writing to the image. We need to
> open it, so share-rw is required.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  blockdev.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Should we make some effort to clear the flag once migration is done
(i.e. via bdrv_reopen())? Also, should we set it everywhere where
BDRV_O_INACTIVE is set (e.g. in postcopy migration, too)?

Is it possible for these images to be opened R/W? If so, we have to make
sure the source has also opened the image in shared mode, otherwise
opening it will fail despite of BDRV_O_SHARE_RW.

Max
diff mbox

Patch

diff --git a/blockdev.c b/blockdev.c
index 9992c5d..230c7c1 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -576,7 +576,7 @@  static BlockBackend *blockdev_init(const char *file, QDict *bs_opts,
         assert((bdrv_flags & BDRV_O_CACHE_MASK) == 0);
 
         if (runstate_check(RUN_STATE_INMIGRATE)) {
-            bdrv_flags |= BDRV_O_INACTIVE;
+            bdrv_flags |= BDRV_O_INACTIVE | BDRV_O_SHARE_RW;
         }
 
         blk = blk_new_open(file, NULL, bs_opts, bdrv_flags, errp);
@@ -646,7 +646,7 @@  static BlockDriverState *bds_tree_init(QDict *bs_opts, Error **errp)
     qdict_set_default_str(bs_opts, BDRV_OPT_READ_ONLY, "off");
 
     if (runstate_check(RUN_STATE_INMIGRATE)) {
-        bdrv_flags |= BDRV_O_INACTIVE;
+        bdrv_flags |= BDRV_O_INACTIVE | BDRV_O_SHARE_RW;
     }
 
     return bdrv_open(NULL, NULL, bs_opts, bdrv_flags, errp);