]> git.ipfire.org Git - thirdparty/libvirt.git/commit
Make checks for inactive QEMU guest more robust
authorDaniel P. Berrange <berrange@redhat.com>
Thu, 10 Jun 2010 14:07:21 +0000 (15:07 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 23 Jun 2010 13:08:05 +0000 (14:08 +0100)
commit8d616decc5faa6bbb9da6693cfe154e8728d555f
treef7bb1f95074b8d46aa960d5a61d270e60374d3d9
parent9b0244ae389c17c4d613f93a0ad162285e087167
Make checks for inactive QEMU guest more robust

Before issuing monitor commands it is neccessary to check whether
the guest is still running. Most places use virDomainIsActive()
correctly, but a few relied on 'priv->mon != NULL'. In theory
these should be equivalent, but the release of the last reference
count on priv->mon can be delayed a small amount of time until
the event handler is finally deregistered. A further ref counting
bug also means that priv->mon might be never released. In such a
case, code could mistakenly issue a monitor command and wait for
a response that will never arrive, effectively leaving the QEMU
driver waiting on virCondWait() forever..

To protect against these possibilities, make sure all code uses
virDomainIsActive(), not 'priv->mon != NULL'

* src/qemu/qemu_driver.c: Replace 'priv->mon != NULL' with
  calls to 'priv->mon != NULL'()
src/qemu/qemu_driver.c