[libvirt] [PATCH 2/3] avoid closing fd more than once

Eric Blake eblake at redhat.com
Thu May 31 03:45:23 UTC 2012


On 05/30/2012 09:03 PM, Wen Congyang wrote:
> At 05/30/2012 09:17 PM, Eric Blake Wrote:
>> On 05/30/2012 03:20 AM, Wen Congyang wrote:
>>> fdstream:
>>>     If fd is fds[0] or fds[1], we should set to -1 if we meet
>>>     some error.
>>>
>>>     childfd is fds[0] or fds[1], so we should close it only when
>>>     virFDStreamOpenFileInternal() successes.
>>>
>>> qemu_migration:
>>>     If we migrate to fd, spec->fwdType is not MIGRATION_FWD_DIRECT,
>>>     we will close spec->dest.fd.local in qemuMigrationRun(). So we
>>>     should set spec->dest.fd.local to -1 in qemuMigrationRun(). 
>>>
>>> command:
>>>     we should not set *outfd or *errfd if virExecWithHook() failed
>>>     because the caller may close these fds.
>>
>> We should split this into three separate patches, to aid backporting
>> each patch across appropriate versions.  Needs a v2 for this reason; as
>> I want these bugs fixed sooner rather than later, I'll probably help by
>> reposting things myself.
>>

> 
>>
>> Maybe a better solution here would be that when we assign fd and childfd
>> to elements of fds[], then we also assign fds to -1, as in:
> 
> Good idea.

Looks like our email is crossing paths; I just reposted 4 patches as a
v2 series.

I like my version better than your repost, if only because I spent time
in 'git gui blame' tracking down which commit introduced each bug.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

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


More information about the libvir-list mailing list