]> git.ipfire.org Git - thirdparty/libvirt.git/commit
storage: only run safezero if allocation is > 0
authorGuido Günther <agx@sigxcpu.org>
Sun, 23 Aug 2015 20:03:54 +0000 (22:03 +0200)
committerGuido Günther <agx@sigxcpu.org>
Mon, 24 Aug 2015 11:51:44 +0000 (13:51 +0200)
commit269d39afe5c59ecb3d3d64dba52f8cfa8d63d197
tree870ed778c5b351351830d279b05e5dec7f40bb6d
parent2f01cfdf05448513d150ff1914d3444161c531b9
storage: only run safezero if allocation is > 0

While a zero allocation in safezero should be fine it isn't when we use
posix_fallocate which returns EINVAL on a zero allocation.

While we could skip the zero allocation in safezero_posix_fallocate it's
an optimization to do it for all allocations.

This fixes vm installation via virtinst for me which otherwise aborts
like:

   Starting install...
   Retrieving file linux...               | 5.9 MB     00:01 ...
   Retrieving file initrd.gz...           |  29 MB     00:07 ...
   ERROR    Couldn't create storage volume 'virtinst-linux.sBgds4': 'cannot fill file '/var/lib/libvirt/boot/virtinst-linux.sBgds4': Invalid argument'

The error was introduced by e30297b0 as spotted by Chunyan Liu
src/storage/storage_backend.c