From: Wen Congyang Date: Wed, 16 Mar 2011 06:54:28 +0000 (+0800) Subject: unlock the monitor when unwatching the monitor X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9741f3461b14e84816a21e1a9578adb7f1466fa2;p=libvirt.git unlock the monitor when unwatching the monitor 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 --- diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index da380961a0..dc0859408c 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); } static int