[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 02/10] mirror: Fix permission problem with 'replaces
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PATCH 02/10] mirror: Fix permission problem with 'replaces' |
Date: |
Mon, 6 Mar 2017 17:21:54 +0100 |
The 'replaces' option of drive-mirror can be used to mirror a Quorum
node to a new image and then let the target image replace one of the
Quorum children. In order for this graph modification to succeed, the
mirror job needs to lift its restrictions on the target node first
before actually replacing the child.
Signed-off-by: Kevin Wolf <address@hidden>
---
block/mirror.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/block/mirror.c b/block/mirror.c
index 57f26c3..c9185b3 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -509,6 +509,13 @@ static void mirror_exit(BlockJob *job, void *opaque)
* block_job_completed(). */
bdrv_ref(src);
bdrv_ref(mirror_top_bs);
+ bdrv_ref(target_bs);
+
+ /* Remove target parent that still uses BLK_PERM_WRITE/RESIZE before
+ * inserting target_bs at s->to_replace, where we might not be able to get
+ * these permissions. */
+ blk_unref(s->target);
+ s->target = NULL;
/* We don't access the source any more. Dropping any WRITE/RESIZE is
* required before it could become a backing file of target_bs. */
@@ -555,8 +562,7 @@ static void mirror_exit(BlockJob *job, void *opaque)
aio_context_release(replace_aio_context);
}
g_free(s->replaces);
- blk_unref(s->target);
- s->target = NULL;
+ bdrv_unref(target_bs);
/* Remove the mirror filter driver from the graph. Before this, get rid of
* the blockers on the intermediate nodes so that the resulting state is
--
1.8.3.1
- [Qemu-block] [PATCH 00/10] block: Op blocker fixes, Kevin Wolf, 2017/03/06
- [Qemu-block] [PATCH 01/10] commit: Fix error handling, Kevin Wolf, 2017/03/06
- [Qemu-block] [PATCH 02/10] mirror: Fix permission problem with 'replaces',
Kevin Wolf <=
- [Qemu-block] [PATCH 03/10] mirror: Fix permissions for removing mirror_top_bs, Kevin Wolf, 2017/03/06
- [Qemu-block] [PATCH 04/10] mirror: Fix error path for dirty bitmap creation, Kevin Wolf, 2017/03/06
- [Qemu-block] [PATCH 05/10] block: Fix blockdev-snapshot error handling, Kevin Wolf, 2017/03/06
- [Qemu-block] [PATCH 06/10] block: Factor out should_update_child(), Kevin Wolf, 2017/03/06