qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] block/vdi: Fix bmap writing error
@ 2014-10-21  8:51 Max Reitz
  2014-10-21  8:51 ` [Qemu-devel] [PATCH 1/2] block/vdi: Use {DIV_,}ROUND_UP Max Reitz
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Max Reitz @ 2014-10-21  8:51 UTC (permalink / raw)
  To: qemu-devel
  Cc: Kevin Wolf, Stefan Weil, Max Reitz, Stefan Hajnoczi,
	Benoît Canet

The bmap size in block/vdi.c may exceed INT_MAX. Using
bdrv_pwrite_sync() (which takes an int byte count) is therefore not a
good idea. The second patch of this series fixes this by replacing
bdrv_pwrite_sync() by bdrv_write()+bdrv_flush() (we don't need the p in
pwrite here).

The first patch employs ROUND_UP() and DIV_ROUND_UP() in block/vdi.c, so
you are reminded that bmap_size is aligned to BDRV_SECTOR_SIZE for the
second patch.

See https://bugzilla.redhat.com/show_bug.cgi?id=1154940 for a bug
report.

I will not include an iotest in this series because this would require
qemu to allocate and then write about 2G of data; yes, test 1 in 084
fails for me because qemu cannot allocate 4G for the bmap.

In fact, I can only test this once I'm home where I have more RAM
available (I made the mistake of activating swap space to test this only
once).


Max Reitz (2):
  block/vdi: Use {DIV_,}ROUND_UP
  block/vdi: Do not use bdrv_pwrite_sync() for bmap

 block/vdi.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

-- 
1.9.3

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-10-23 13:24 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-21  8:51 [Qemu-devel] [PATCH 0/2] block/vdi: Fix bmap writing error Max Reitz
2014-10-21  8:51 ` [Qemu-devel] [PATCH 1/2] block/vdi: Use {DIV_,}ROUND_UP Max Reitz
2014-10-21 16:58   ` Eric Blake
2014-10-21  8:51 ` [Qemu-devel] [PATCH 2/2] block/vdi: Do not use bdrv_pwrite_sync() for bmap Max Reitz
2014-10-21 17:00   ` Eric Blake
2014-10-22 11:56 ` [Qemu-devel] [PATCH 0/2] block/vdi: Fix bmap writing error Kevin Wolf
2014-10-23  7:07   ` Max Reitz
2014-10-23  7:07   ` Max Reitz
2014-10-23 13:24     ` Max Reitz

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).