[libvirt] [PATCH 1/2] avoid vm to be deleted if qemuConnectMonitor failed

Eric Blake eblake at redhat.com
Tue Jan 25 16:14:46 UTC 2011


On 01/24/2011 11:43 PM, Wen Congyang wrote:
> 
> We should add an extra reference of vm to avoid vm to be deleted if
> qemuConnectMonitor() failed.

Thanks for the detailed analysis.  On crashes like these, the commit
message is as important as the patch itself.  I would have gone one step
further, and included the crash recipe in 0/2 in the commit message.

> +++ b/src/qemu/qemu_driver.c
> @@ -930,6 +930,10 @@ qemuReconnectDomain(void *payload, const char *name ATTRIBUTE_UNUSED, void *opaq
>  
>      priv = obj->privateData;
>  
> +    /* Hold an extra reference because we can't allow 'vm' to be
> +     * deleted if qemuConnectMonitor() failed */
> +    virDomainObjRef(obj);

ACK - this idiom matches other places in code where reducing the
references to 0 on an error path has disastrous consequences, so
maintaining the extra ref makes sense.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

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


More information about the libvir-list mailing list