From e023b2e244ddcc25308309d20c6bfd037897b10c Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 8 May 2012 16:51:41 +0200 Subject: block: fix snapshot on QED QED's opaque data includes a pointer back to the BlockDriverState. This breaks when bdrv_append shuffles data between bs_new and bs_top. To avoid this, add a "rebind" function that tells the driver about the new relationship between the BlockDriverState and its opaque. The patch also adds rebind to VVFAT for completeness, even though it is not used with live snapshots. Reviewed-by: Stefan Hajnoczi Reviewed-by: Kevin Wolf Signed-off-by: Paolo Bonzini Signed-off-by: Kevin Wolf --- block/vvfat.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'block/vvfat.c') diff --git a/block/vvfat.c b/block/vvfat.c index 9ef21dd..2dc9d50 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -982,6 +982,12 @@ static BDRVVVFATState *vvv = NULL; static int enable_write_target(BDRVVVFATState *s); static int is_consistent(BDRVVVFATState *s); +static void vvfat_rebind(BlockDriverState *bs) +{ + BDRVVVFATState *s = bs->opaque; + s->bs = bs; +} + static int vvfat_open(BlockDriverState *bs, const char* dirname, int flags) { BDRVVVFATState *s = bs->opaque; @@ -2855,6 +2861,7 @@ static BlockDriver bdrv_vvfat = { .format_name = "vvfat", .instance_size = sizeof(BDRVVVFATState), .bdrv_file_open = vvfat_open, + .bdrv_rebind = vvfat_rebind, .bdrv_read = vvfat_co_read, .bdrv_write = vvfat_co_write, .bdrv_close = vvfat_close, -- cgit v1.1