Re: [PATCH] Fix deadlock in QEMU close callback APIs

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

 



On Thu, Feb 28, 2013 at 01:33:31PM +0000, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> There is a lock ordering problem in the QEMU close callback
> APIs.
> 
> When starting a guest we have a lock on the VM. We then
> set a autodestroy callback, which acquires a lock on the
> close callbacks.
> 
> When running auto-destroy, we obtain a lock on the close
> callbacks, then run each callbacks - which obtains a lock
> on the VM.
> 
> This causes deadlock if anyone tries to start a VM, while
> autodestroy is taking place.
> 
> The fix is to do autodestroy in 2 phases. First obtain
> all the callbacks and remove them from the list under
> the close callback lock. Then invoke each callback
> from outside the close callback lock.
> 
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  src/qemu/qemu_conf.c  | 106 ++++++++++++++++++++++++++++++++++++++++++--------
>  src/util/virnetlink.c |   5 ++-
>  2 files changed, 92 insertions(+), 19 deletions(-)
> 

> diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c
> index 0b36fdc..8b47ede 100644
> --- a/src/util/virnetlink.c
> +++ b/src/util/virnetlink.c
> @@ -335,8 +335,9 @@ virNetlinkEventCallback(int watch,
>      if (length == 0)
>          return;
>      if (length < 0) {
> -        virReportSystemError(errno,
> -                             "%s", _("nl_recv returned with error"));
> +        virReportError(VIR_ERR_INTERNAL_ERROR,
> +                       _("nl_recv returned with error: %s"),
> +                       nl_geterror(length));
>          return;
>      }

This chunk wasn't supposed to be here. I've sent it as a separate fix

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
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]