提交 cc2424fc 编写于 作者: W Wen Congyang

do not send monitor command after monitor meet error

If the monitor met a error, and we will call qemuProcessHandleMonitorEOF().
But we may try to send monitor command after qemuProcessHandleMonitorEOF()
returned. Then libvirtd will be blocked in qemuMonitorSend().

Steps to reproduce this bug:
1. use gdb to attach libvirtd, and set a breakpoint in the function
   qemuConnectMonitor()
2. start a vm
3. let the libvirtd to run until qemuMonitorOpen() returns.
4. kill the qemu process
5. continue running libvirtd
Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
上级 025e1998
......@@ -587,6 +587,15 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) {
void (*eofNotify)(qemuMonitorPtr, virDomainObjPtr, int)
= mon->cb->eofNotify;
virDomainObjPtr vm = mon->vm;
/* If qemu quited unexpectedly, and we may try to send monitor
* command later. But we have no chance to wake up it. So set
* mon->lastErrno to EIO, and check it before sending monitor
* command.
*/
if (!mon->lastErrno)
mon->lastErrno = EIO;
/* Make sure anyone waiting wakes up now */
virCondSignal(&mon->notify);
if (qemuMonitorUnref(mon) > 0)
......@@ -725,6 +734,12 @@ int qemuMonitorSend(qemuMonitorPtr mon,
{
int ret = -1;
/* Check whether qemu quited unexpectedly */
if (mon->lastErrno) {
msg->lastErrno = mon->lastErrno;
return -1;
}
mon->msg = msg;
qemuMonitorUpdateWatch(mon);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册