Re: [PATCH] qemu driver: use lseek64 for setting position in logfile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



libvir-list-bounces@xxxxxxxxxx wrote on 01/04/2011 09:46:07 AM:

>
> While doing some testing with Qemu and creating huge logfiles I
> encountered the case where the VM could not start anymore due to the
> lseek() to the end of the Qemu VM's log file failing. The patch below
> replaces the two occurrences of lseek() in the relevant path with
> lseek64() and solves this problem. It may be a good idea to look at
> other occurrences of lseek() as well whether they should be replaced.
> off_t is 8 bytes long (64 bit), so it doesn't need to be replaced with
> the explicit off64_t.
>
> To reproduce this error, you could do the following:
>
> dd if=/dev/zero of=/var/log/libvirt/qemu/<name of VM>.log bs=1024
> count=$((1024*2048))
>
> and you should get an error like this:
>
> error: Failed to start domain <name of VM>
> error: Unable to seek to -2147482651 in /var/log/libvirt/qemu/<name of
> VM>.log: Success
>
> Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx>
>
> ---
>   src/qemu/qemu_driver.c |    6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> Index: libvirt-acl/src/qemu/qemu_driver.c
> ===================================================================
> --- libvirt-acl.orig/src/qemu/qemu_driver.c
> +++ libvirt-acl/src/qemu/qemu_driver.c
[...]


> @@ -2624,7 +2624,7 @@ static int qemudStartVMDaemon(virConnect
>                                 enum virVMOperationType vmop) {
>       int ret;
>       unsigned long long qemuCmdFlags;
> -    int pos = -1;
> +    off_t pos = -1;
>       char ebuf[1024];
>       char *pidfile = NULL;
>       int logfile = -1;


... actually this is really the only hunk that's necessary to fix this problem.

  Stefan
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]