
On 09/03/2014 12:41 AM, Francesco Romani wrote:
[3] Ouch. This function is unlocking vm, even though it did not obtain the lock. Which it kind of has to do because of the way that qemuDomainObjEndJob may end up invalidating vm. While transfer semantics are workable, they require good comments at the start of the function, and making sure that the caller doesn't duplicate the efforts, nor forget anything else.
Will add comment documenting this. Is this sufficient or there is something better I could do?
A comment is sufficient. Here's a similar comment I'm adding in my series for virDomainBlockCopy: /* bandwidth in bytes/s. Caller must lock vm beforehand, and not * access it afterwards. */ static int qemuDomainBlockCopyCommon(virDomainObjPtr vm, virConnectPtr conn, const char *path, virStorageSourcePtr dest, unsigned long long bandwidth, unsigned int flags) -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org