[libvirt] [PATCH] avoid shutting down the vm twice

Eric Blake eblake at redhat.com
Wed Feb 2 18:33:54 UTC 2011


On 02/02/2011 06:18 AM, Jiri Denemark wrote:
>>> +     * vm is active before shutdown.
>>> +     */
>>> +    if (virDomainObjIsActive(vm))
>>> +        qemudShutdownVMDaemon(driver, vm, 0);
>>
>> I'm still playing with this patch, but at first glance, it is making
>> sense to me.
> 
> The patch makes sense to me, since we may unlock the domain object several
> times before we get to the cleanup code. Thus the state may have changed by
> the time we get there.
> 
> Eric, what is the result of you playing with the patch? Is it ok to ack and
> push it?

I've confirmed that this patch does indeed make a difference in the
scenario Wen posted, where without the patch, I did indeed get a
double-free segfault in libvirtd due to simultaneous shutdown attempts
from two threads, but only one shutdown and no crash with the patch.

However, I'm testing an alternate patch based on danpb's suggestion of
hoisting the check into qemudShutdownVMDaemon (or qemuProcessStop, if
danpb's refactoring into qemu_process goes in first), which I'll post
shortly.

-- 
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/20110202/32772e20/attachment-0001.sig>


More information about the libvir-list mailing list