[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 17/18] commit: get the overlay node before manipulati
From: |
Max Reitz |
Subject: |
[Qemu-devel] [PULL 17/18] commit: get the overlay node before manipulating the backing chain |
Date: |
Wed, 14 Sep 2016 18:41:01 +0200 |
From: Alberto Garcia <address@hidden>
The 'block-commit' command has a 'top' parameter to specify the
topmost node from which the data is going to be copied.
[E] <- [D] <- [C] <- [B] <- [A]
In this case if [C] is the top node then this is the result:
[E] <- [B] <- [A]
[B] must be modified so its backing image string points to [E] instead
of [C]. commit_start() takes care of reopening [B] in read-write
mode, and commit_complete() puts it back in read-only mode once the
operation has finished.
In order to find [B] (the overlay node) we look for the node that has
[C] (the top node) as its backing image. However in commit_complete()
we're doing it after [C] has been removed from the chain, so [B] is
never found and remains in read-write mode.
This patch gets the overlay node before the backing chain is
manipulated.
Signed-off-by: Alberto Garcia <address@hidden>
Message-id: address@hidden
Signed-off-by: Max Reitz <address@hidden>
---
block/commit.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/block/commit.c b/block/commit.c
index 553e18d..a02539b 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -83,7 +83,7 @@ static void commit_complete(BlockJob *job, void *opaque)
BlockDriverState *active = s->active;
BlockDriverState *top = blk_bs(s->top);
BlockDriverState *base = blk_bs(s->base);
- BlockDriverState *overlay_bs;
+ BlockDriverState *overlay_bs = bdrv_find_overlay(active, top);
int ret = data->ret;
if (!block_job_is_cancelled(&s->common) && ret == 0) {
@@ -97,7 +97,6 @@ static void commit_complete(BlockJob *job, void *opaque)
if (s->base_flags != bdrv_get_flags(base)) {
bdrv_reopen(base, s->base_flags, NULL);
}
- overlay_bs = bdrv_find_overlay(active, top);
if (overlay_bs && s->orig_overlay_flags != bdrv_get_flags(overlay_bs)) {
bdrv_reopen(overlay_bs, s->orig_overlay_flags, NULL);
}
--
2.5.5
- [Qemu-devel] [PULL 07/18] hbitmap: serialization, (continued)
- [Qemu-devel] [PULL 07/18] hbitmap: serialization, Max Reitz, 2016/09/14
- [Qemu-devel] [PULL 08/18] block: BdrvDirtyBitmap serialization interface, Max Reitz, 2016/09/14
- [Qemu-devel] [PULL 10/18] block: More operations for meta dirty bitmap, Max Reitz, 2016/09/14
- [Qemu-devel] [PULL 09/18] tests: Add test code for hbitmap serialization, Max Reitz, 2016/09/14
- [Qemu-devel] [PULL 11/18] qemu-img: add the 'dd' subcommand, Max Reitz, 2016/09/14
- [Qemu-devel] [PULL 13/18] blockdev: prepare iSCSI block driver for dynamic loading, Max Reitz, 2016/09/14
- [Qemu-devel] [PULL 12/18] qemu-img: add skip option to dd, Max Reitz, 2016/09/14
- [Qemu-devel] [PULL 14/18] blockdev: Add dynamic generation of module_block.h, Max Reitz, 2016/09/14
- [Qemu-devel] [PULL 16/18] blockdev: Modularize nfs block driver, Max Reitz, 2016/09/14
- [Qemu-devel] [PULL 15/18] blockdev: Add dynamic module loading for block drivers, Max Reitz, 2016/09/14
- [Qemu-devel] [PULL 17/18] commit: get the overlay node before manipulating the backing chain,
Max Reitz <=
- [Qemu-devel] [PULL 18/18] iotest 055: refactor and speed up, Max Reitz, 2016/09/14
- Re: [Qemu-devel] [PULL 00/18] Block layer patches, no-reply, 2016/09/14
- Re: [Qemu-devel] [PULL 00/18] Block layer patches, Peter Maydell, 2016/09/15
- [Qemu-devel] [PULL 00/18] Block layer patches, Kevin Wolf, 2016/09/27
- [Qemu-devel] [PULL 05/18] block: Drop aio/cache consistency check from qmp_blockdev_add(), Kevin Wolf, 2016/09/27
- [Qemu-devel] [PULL 02/18] qemu: use bdrv_flush_all for vm_stop et al, Kevin Wolf, 2016/09/27
- [Qemu-devel] [PULL 01/18] block: reintroduce bdrv_flush_all, Kevin Wolf, 2016/09/27
- [Qemu-devel] [PULL 03/18] block-backend: remove blk_flush_all, Kevin Wolf, 2016/09/27
- [Qemu-devel] [PULL 06/18] block/qapi: Use separate options type for curl driver, Kevin Wolf, 2016/09/27