aboutsummaryrefslogtreecommitdiff
path: root/block/commit.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2013-01-20 11:01:10 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2013-01-20 11:01:10 -0600
commit8b17ed4caa7e015324a4ecbe3c863e32458d840a (patch)
treee323612dffd78dd4cb75f58f731d208c0bf9ffce /block/commit.c
parentb54c2873e731dd6fc81a4591cab909633b5a9eab (diff)
parentcf139388ad5b39228793f34eea99e0ea9a2924aa (diff)
Merge remote-tracking branch 'stefanha/block' into staging
# By Kevin Wolf (4) and others # Via Stefan Hajnoczi * stefanha/block: dataplane: support viostor virtio-pci status bit setting dataplane: avoid reentrancy during virtio_blk_data_plane_stop() win32-aio: use iov utility functions instead of open-coding them win32-aio: Fix memory leak win32-aio: Fix vectored reads aio: Fix return value of aio_poll() ide: Remove wrong assertion block: fix null-pointer bug on error case in block commit
Diffstat (limited to 'block/commit.c')
-rw-r--r--block/commit.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/block/commit.c b/block/commit.c
index 61ebdba54f..553447efe7 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -65,7 +65,7 @@ static void coroutine_fn commit_run(void *opaque)
BlockDriverState *active = s->active;
BlockDriverState *top = s->top;
BlockDriverState *base = s->base;
- BlockDriverState *overlay_bs = NULL;
+ BlockDriverState *overlay_bs;
int64_t sector_num, end;
int ret = 0;
int n = 0;
@@ -92,8 +92,6 @@ static void coroutine_fn commit_run(void *opaque)
}
}
- overlay_bs = bdrv_find_overlay(active, top);
-
end = s->common.len >> BDRV_SECTOR_BITS;
buf = qemu_blockalign(top, COMMIT_BUFFER_SIZE);
@@ -156,7 +154,8 @@ exit_restore_reopen:
if (s->base_flags != bdrv_get_flags(base)) {
bdrv_reopen(base, s->base_flags, NULL);
}
- if (s->orig_overlay_flags != bdrv_get_flags(overlay_bs)) {
+ 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);
}