* [Qemu-devel] [PATCH] block: record new size in bdrv_dirty_bitmap_truncate @ 2015-06-08 20:49 John Snow 2015-06-08 21:14 ` Eric Blake 2015-06-09 9:24 ` Kevin Wolf 0 siblings, 2 replies; 5+ messages in thread From: John Snow @ 2015-06-08 20:49 UTC (permalink / raw) To: qemu-block; +Cc: kwolf, vsementsov, John Snow, qemu-devel, stefanha ce1ffea8 neglected to update the BdrvDirtyBitmap structure itself for internal consistency. It's currently not an issue, but for migration and persistence series this will cause headaches. Signed-off-by: John Snow <jsnow@redhat.com> --- block.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block.c b/block.c index 2b9ceae..2786e47 100644 --- a/block.c +++ b/block.c @@ -3224,6 +3224,7 @@ static void bdrv_dirty_bitmap_truncate(BlockDriverState *bs) continue; } hbitmap_truncate(bitmap->bitmap, size); + bitmap->size = size; } } -- 2.1.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] block: record new size in bdrv_dirty_bitmap_truncate 2015-06-08 20:49 [Qemu-devel] [PATCH] block: record new size in bdrv_dirty_bitmap_truncate John Snow @ 2015-06-08 21:14 ` Eric Blake 2015-06-09 9:24 ` Kevin Wolf 1 sibling, 0 replies; 5+ messages in thread From: Eric Blake @ 2015-06-08 21:14 UTC (permalink / raw) To: John Snow, qemu-block; +Cc: kwolf, vsementsov, qemu-devel, stefanha [-- Attachment #1: Type: text/plain, Size: 852 bytes --] On 06/08/2015 02:49 PM, John Snow wrote: > ce1ffea8 neglected to update the BdrvDirtyBitmap structure > itself for internal consistency. It's currently not an issue, > but for migration and persistence series this will cause headaches. > > Signed-off-by: John Snow <jsnow@redhat.com> > --- > block.c | 1 + > 1 file changed, 1 insertion(+) Reviewed-by: Eric Blake <eblake@redhat.com> > > diff --git a/block.c b/block.c > index 2b9ceae..2786e47 100644 > --- a/block.c > +++ b/block.c > @@ -3224,6 +3224,7 @@ static void bdrv_dirty_bitmap_truncate(BlockDriverState *bs) > continue; > } > hbitmap_truncate(bitmap->bitmap, size); > + bitmap->size = size; > } > } > > -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org [-- Attachment #2: OpenPGP digital signature --] [-- Type: application/pgp-signature, Size: 604 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] block: record new size in bdrv_dirty_bitmap_truncate 2015-06-08 20:49 [Qemu-devel] [PATCH] block: record new size in bdrv_dirty_bitmap_truncate John Snow 2015-06-08 21:14 ` Eric Blake @ 2015-06-09 9:24 ` Kevin Wolf 2015-06-09 15:46 ` John Snow 1 sibling, 1 reply; 5+ messages in thread From: Kevin Wolf @ 2015-06-09 9:24 UTC (permalink / raw) To: John Snow; +Cc: vsementsov, stefanha, qemu-devel, qemu-block Am 08.06.2015 um 22:49 hat John Snow geschrieben: > ce1ffea8 neglected to update the BdrvDirtyBitmap structure > itself for internal consistency. It's currently not an issue, > but for migration and persistence series this will cause headaches. > > Signed-off-by: John Snow <jsnow@redhat.com> I know nothing about dirty bitmaps, but this one looks obvious enough, I'll apply it. > diff --git a/block.c b/block.c > index 2b9ceae..2786e47 100644 > --- a/block.c > +++ b/block.c > @@ -3224,6 +3224,7 @@ static void bdrv_dirty_bitmap_truncate(BlockDriverState *bs) > continue; > } > hbitmap_truncate(bitmap->bitmap, size); > + bitmap->size = size; > } > } However, I'm left wondering whether that 'continue' in the context of that hunk is right. More context: QLIST_FOREACH(bitmap, &bs->dirty_bitmaps, list) { if (bdrv_dirty_bitmap_frozen(bitmap)) { continue; } hbitmap_truncate(bitmap->bitmap, size); } If the image just shrunk, the frozen bitmap covers parts of the image that don't exist any more. When they are read out for the backup, that request would fail. If the image was extended, the frozen bitmap covers only part of the image. There are a few bitmap functions that don't check the size and would just work beyond the end of the bitmap if called with a now valid sector number that is outside the image. In practice, I don't think any of these happen because of op blockers that prevent resizing while a backup is in progress, but should !bdrv_dirty_bitmap_frozen(bitmap) be asserted then rather than just skipping the bitmap? Kevin ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] block: record new size in bdrv_dirty_bitmap_truncate 2015-06-09 9:24 ` Kevin Wolf @ 2015-06-09 15:46 ` John Snow 2015-06-10 7:59 ` Kevin Wolf 0 siblings, 1 reply; 5+ messages in thread From: John Snow @ 2015-06-09 15:46 UTC (permalink / raw) To: Kevin Wolf; +Cc: qemu-block, vsementsov, qemu-devel, stefanha On 06/09/2015 05:24 AM, Kevin Wolf wrote: > Am 08.06.2015 um 22:49 hat John Snow geschrieben: >> ce1ffea8 neglected to update the BdrvDirtyBitmap structure >> itself for internal consistency. It's currently not an issue, >> but for migration and persistence series this will cause headaches. >> >> Signed-off-by: John Snow <jsnow@redhat.com> > > I know nothing about dirty bitmaps, but this one looks obvious enough, > I'll apply it. > >> diff --git a/block.c b/block.c >> index 2b9ceae..2786e47 100644 >> --- a/block.c >> +++ b/block.c >> @@ -3224,6 +3224,7 @@ static void bdrv_dirty_bitmap_truncate(BlockDriverState *bs) >> continue; >> } >> hbitmap_truncate(bitmap->bitmap, size); >> + bitmap->size = size; >> } >> } > > However, I'm left wondering whether that 'continue' in the context of > that hunk is right. More context: > > QLIST_FOREACH(bitmap, &bs->dirty_bitmaps, list) { > if (bdrv_dirty_bitmap_frozen(bitmap)) { > continue; > } > hbitmap_truncate(bitmap->bitmap, size); > } > > If the image just shrunk, the frozen bitmap covers parts of the image > that don't exist any more. When they are read out for the backup, that > request would fail. > > If the image was extended, the frozen bitmap covers only part of the > image. There are a few bitmap functions that don't check the size and > would just work beyond the end of the bitmap if called with a now valid > sector number that is outside the image. > > In practice, I don't think any of these happen because of op blockers > that prevent resizing while a backup is in progress, but should > !bdrv_dirty_bitmap_frozen(bitmap) be asserted then rather than just > skipping the bitmap? > > Kevin > Yeah, that won't hurt anything and will read cleaner. I'll just v2 this patch, thanks. --js ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] block: record new size in bdrv_dirty_bitmap_truncate 2015-06-09 15:46 ` John Snow @ 2015-06-10 7:59 ` Kevin Wolf 0 siblings, 0 replies; 5+ messages in thread From: Kevin Wolf @ 2015-06-10 7:59 UTC (permalink / raw) To: John Snow; +Cc: qemu-block, vsementsov, qemu-devel, stefanha Am 09.06.2015 um 17:46 hat John Snow geschrieben: > > > On 06/09/2015 05:24 AM, Kevin Wolf wrote: > > Am 08.06.2015 um 22:49 hat John Snow geschrieben: > >> ce1ffea8 neglected to update the BdrvDirtyBitmap structure > >> itself for internal consistency. It's currently not an issue, > >> but for migration and persistence series this will cause headaches. > >> > >> Signed-off-by: John Snow <jsnow@redhat.com> > > > > I know nothing about dirty bitmaps, but this one looks obvious enough, > > I'll apply it. > > > >> diff --git a/block.c b/block.c > >> index 2b9ceae..2786e47 100644 > >> --- a/block.c > >> +++ b/block.c > >> @@ -3224,6 +3224,7 @@ static void bdrv_dirty_bitmap_truncate(BlockDriverState *bs) > >> continue; > >> } > >> hbitmap_truncate(bitmap->bitmap, size); > >> + bitmap->size = size; > >> } > >> } > > > > However, I'm left wondering whether that 'continue' in the context of > > that hunk is right. More context: > > > > QLIST_FOREACH(bitmap, &bs->dirty_bitmaps, list) { > > if (bdrv_dirty_bitmap_frozen(bitmap)) { > > continue; > > } > > hbitmap_truncate(bitmap->bitmap, size); > > } > > > > If the image just shrunk, the frozen bitmap covers parts of the image > > that don't exist any more. When they are read out for the backup, that > > request would fail. > > > > If the image was extended, the frozen bitmap covers only part of the > > image. There are a few bitmap functions that don't check the size and > > would just work beyond the end of the bitmap if called with a now valid > > sector number that is outside the image. > > > > In practice, I don't think any of these happen because of op blockers > > that prevent resizing while a backup is in progress, but should > > !bdrv_dirty_bitmap_frozen(bitmap) be asserted then rather than just > > skipping the bitmap? > > > > Kevin > > > > Yeah, that won't hurt anything and will read cleaner. I'll just v2 this > patch, thanks. It's unrelated to this patch (except for touching the same function), so I'd suggest to make it a separate patch. Kevin ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-06-10 7:59 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-06-08 20:49 [Qemu-devel] [PATCH] block: record new size in bdrv_dirty_bitmap_truncate John Snow 2015-06-08 21:14 ` Eric Blake 2015-06-09 9:24 ` Kevin Wolf 2015-06-09 15:46 ` John Snow 2015-06-10 7:59 ` Kevin Wolf
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).