]> xenbits.xensource.com Git - libvirt.git/commit
qemu_agent: Ignore expected EOFs
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 21 Jan 2013 10:52:44 +0000 (11:52 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 23 Jan 2013 14:35:44 +0000 (15:35 +0100)
commitd960d06fc06a448f495c465caf06d3d0c74ea587
treebe01aaef0870c59f8e0f9945a82a346ea45f05f9
parent9ff3876cc811f14a8f21bccf947338b90c8e66b1
qemu_agent: Ignore expected EOFs

https://bugzilla.redhat.com/show_bug.cgi?id=892079

One of my previous patches (f2a4e5f176c408) tried to fix crashing
libvirtd on domain detroy. However, we need to copy pattern from
qemuProcessHandleMonitorEOF() instead of decrementing reference
counter. The rationale for this is, if qemu process is dying due
to domain being destroyed, we obtain EOF on both the monitor and
agent sockets. However, if the exit is expected, qemuProcessStop
is called, which cleans both agent and monitor sockets up. We
want qemuAgentClose() to be called iff the EOF is not expected,
so we don't leak an FD and memory. Moreover, there could be race
with qemuProcessHandleMonitorEOF() which could have already
closed the agent socket, in which case we don't want to do
anything.
src/qemu/qemu_process.c