[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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 redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]