[libvirt] [PATCHv3 08/43] snapshot: avoid crash when deleting qemu snapshots

Eric Blake eblake at redhat.com
Wed Aug 24 19:32:17 UTC 2011


On 08/24/2011 12:34 PM, Eric Blake wrote:
> On 08/24/2011 10:38 AM, Daniel P. Berrange wrote:
>> On Wed, Aug 24, 2011 at 09:22:25AM -0600, Eric Blake wrote:
>>> This one's nasty. Ever since we fixed virHashForEach to prevent
>>> nested hash iterations for safety reasons, virDomainSnapshotDelete
>>> with VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN has been broken for qemu:
>>> it deletes children, while leaving grandchildren intact but pointing
>>> to a no-longer-present parent. But even before then, the code would
>>> often appear to succeed to clean up grandchildren, but risked memory
>>> corruption if you have a large and deep hierarchy of snapshots.
>>>
>> I also still saw errors in libvirtd logs
>>
>> 17:36:36.175: 4423: info : libvirt version: 0.9.4
>> 17:36:36.175: 4423: error : virHashSearch:604 : Hash operation not
>> allowed during iteration
>> 17:36:36.176: 4423: warning : virDomainSnapshotMarkDescendant:11309 :
>> snapshot hash table is inconsistent!
>
> Ouch; I can reproduce. I guess I didn't test this one as thoroughly as I
> had planned, and this is indeed a bug in my 'forEachDescendant'
> iterator. I'll post an update once I figure out where I went wrong.

Found the problem - virDomainSnapshotFindByName is doing a full hash 
search instead of a simple lookup - and recursive searches are verboten. 
  Fix that, and we still have a problem - if the current snapshot is in 
the set of snapshots being deleted, then the parent snapshot needs to 
become current again.  I'll post a couple of patches shortly.

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




More information about the libvir-list mailing list