block: respect error code from bdrv_getlength in handle_aiocb_write_zeroes
commit70d9110b440e5252f637d54b5efd33bbc6237c1f
authorDenis V. Lunev <den@openvz.org>
Fri, 4 Aug 2017 15:10:11 +0000 (4 18:10 +0300)
committerKevin Wolf <kwolf@redhat.com>
Tue, 8 Aug 2017 13:19:16 +0000 (8 15:19 +0200)
tree1f5ce5f288f35b9d2f99bb9da3c7fe201cb76d20
parent0e51b9b7c7b24127e9996259b611db3177ef6444
block: respect error code from bdrv_getlength in handle_aiocb_write_zeroes

Original idea beyond the code in question was the following: we have failed
to write zeroes with fallocate(FALLOC_FL_ZERO_RANGE) as the simplest
approach and via fallocate(FALLOC_FL_PUNCH_HOLE)/fallocate(0). We have the
only chance now: if the request comes beyond end of the file. Thus we
should calculate file length and respect the error code from that op.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Markus Armbruster <armbru@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Max Reitz <mreitz@redhat.com>
CC: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
block/file-posix.c