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

Re: [libvirt] [PATCH] unlock the monitor when unwatching the monitor



On Wed, Mar 16, 2011 at 02:54:28PM +0800, Wen Congyang wrote:
> Steps to reproduce this bug:
> # virsh qemu-monitor-command domain 'cpu_set 2 online' --hmp
> The domain has 2 cpus, and we try to set the third cpu online.
> The qemu crashes, and this command will hang.
> 
> The reason is that the refs is not 1 when we unwatch the monitor.
> We lock the monitor, but we do not unlock it. So virCondWait()
> will be blocked.
> 
> Signed-off-by: Wen Congyang <wency cn fujitsu com>
> 
> ---
>  src/qemu/qemu_monitor.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
> index da38096..dc08594 100644
> --- a/src/qemu/qemu_monitor.c
> +++ b/src/qemu/qemu_monitor.c
> @@ -239,7 +239,8 @@ qemuMonitorUnwatch(void *monitor)
>      qemuMonitorPtr mon = monitor;
>  
>      qemuMonitorLock(mon);
> -    qemuMonitorUnref(mon);
> +    if (qemuMonitorUnref(mon) > 0)
> +        qemuMonitorUnlock(mon);
>  }

ACK

We should probably annotate qemuMonitorUnref() (and similar functions)
with ATTRIBUTE_RETURN_CHECK too

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


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