[libvirt] [PATCH 2/4] Avoid bogus I/O event errors when closing the QEMU monitor

Eric Blake eblake at redhat.com
Fri Sep 28 15:10:22 UTC 2012


On 09/28/2012 08:58 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> After calling qemuMonitorClose(), it is still possible for
> the QEMU monitor I/O event callback to get invoked. This
> will trigger an error message because mon->fd has been set
> to -1 at this point. Silently ignore the case where mon->fd
> is -1, likewise for mon->watch being zero.
> 
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
>  src/qemu/qemu_monitor.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 

> @@ -830,9 +838,12 @@ void qemuMonitorClose(qemuMonitorPtr mon)
>            "mon=%p refs=%d", mon, mon->object.refs);
>  
>      if (mon->fd >= 0) {
> -        if (mon->watch)
> +        if (mon->watch) {
>              virEventRemoveHandle(mon->watch);
> +            mon->watch = 0;
> +        }
>          VIR_FORCE_CLOSE(mon->fd);
> +        fprintf(stderr, "Closing monitr\n");

Oops.

ACK with the debugging cruft elided.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120928/29eae3d5/attachment-0001.sig>


More information about the libvir-list mailing list