OSDN Git Service

block: Handle failure for potentially large allocations
authorKevin Wolf <kwolf@redhat.com>
Tue, 20 May 2014 11:16:51 +0000 (13:16 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 15 Aug 2014 13:07:15 +0000 (15:07 +0200)
commit857d4f46c31d2f4d57d2f0fad9dfb584262bf9b9
tree62fdf72b2612d26dc6459fb77252f0652d1d41d8
parent7d2a35cc921ea4832083a7e8598461868bb538ce
block: Handle failure for potentially large allocations

Some code in the block layer makes potentially huge allocations. Failure
is not completely unexpected there, so avoid aborting qemu and handle
out-of-memory situations gracefully.

This patch addresses bounce buffer allocations in block.c. While at it,
convert bdrv_commit() from plain g_malloc() to qemu_try_blockalign().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
block.c