On 08/24/2015 05:44 AM, Martin Kletzander wrote:
On Sun, Aug 23, 2015 at 10:14:29PM +0200, Guido Günther wrote:
> 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'
> ---
> No idea while this didn't show up earlier though.
>
ACK, that was probably caused due to previous unclean installation.
I tripped across this recently too, but had nothing to do with
installations - rather the bug I'm looking at is dealing with creating a
volume in an NFS pool. I think the "root cause" is commit id
'e30297b09'.
In my bz, the input vol.xml has:
<capacity>4048576000</capacity>
<allocation>0</allocation>
which in the code prior to commit e30297b09 would have left remain = 0
and regardless if need_alloc was true and avoided the safezero.
I have to assume your situation was similar.
John
> src/storage/storage_backend.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/storage/storage_backend.c
> b/src/storage/storage_backend.c
> index db49739..0418473 100644
> --- a/src/storage/storage_backend.c
> +++ b/src/storage/storage_backend.c
> @@ -455,7 +455,7 @@ createRawFile(int fd, virStorageVolDefPtr vol,
> pos = inputvol->target.capacity - remain;
> }
>
> - if (need_alloc) {
> + if (need_alloc && (vol->target.allocation - pos > 0)) {
> if (safezero(fd, pos, vol->target.allocation - pos) < 0) {
> ret = -errno;
> virReportSystemError(errno, _("cannot fill file
'%s'"),
> --
> 2.1.4
>
> --
> libvir-list mailing list
> libvir-list(a)redhat.com
>
https://www.redhat.com/mailman/listinfo/libvir-list
--
libvir-list mailing list
libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list