]> xenbits.xensource.com Git - libvirt.git/commitdiff
unlock the monitor when unwatching the monitor
authorWen Congyang <wency@cn.fujitsu.com>
Wed, 16 Mar 2011 06:54:28 +0000 (14:54 +0800)
committerEric Blake <eblake@redhat.com>
Thu, 17 Mar 2011 23:29:38 +0000 (17:29 -0600)
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

index da380961a0ac86ceb569732114801390e35c3bce..dc0859408ca7de7685f45664056173230bfa05a4 100644 (file)
@@ -239,7 +239,8 @@ qemuMonitorUnwatch(void *monitor)
     qemuMonitorPtr mon = monitor;
 
     qemuMonitorLock(mon);
-    qemuMonitorUnref(mon);
+    if (qemuMonitorUnref(mon) > 0)
+        qemuMonitorUnlock(mon);
 }
 
 static int