[libvirt] [Qemu-devel] [PATCH v2 2/4] qapi: Add passfd QMP command

Eric Blake eblake at redhat.com
Wed Jun 13 20:47:29 UTC 2012


On 06/13/2012 02:25 PM, Corey Bryant wrote:

>> Also, getfd automatically closes a fd if an existing fdname is passed
>> again.
>> I don't think this is a good behavior, I think pass-fd should fail
>> instead
>> (note that we can't fix getfd though).
>>
> 
> I agree.  It makes sense to fail rather than blindly closing the
> existing fd.  It can be closed explicitly with closefd if the user wants
> it closed.

Hmm - what happens if I do 'pass-fd name', learn that qemu is using fd
42, then do 'getfd name'?  I silently wipe out fd 42 and replace it with
the new fd passed in by getfd.  Which means my use of /dev/fd/42 will
now be broken.

Obviously that means that 'getfd' should NOT be used by any application
using 'pass-fd', and that libvirt should NOT be reusing names (I think
the latter is already true).  But I agree that for back-compat we can't
get rid of the current (evil) semantics of a duplicated 'getfd'.

You may also want to mention that when using 'getfd' or 'pass-fd', there
are some commands (like migrate) that use the fd:name protocol, and that
a successful use of one of these commands implicitly closes the named
fd; but that all new uses of /dev/fd/nnn leave the fd open and an
explicit closefd must be used to avoid leaking indefinitely-opened fds
in qemu.

-- 
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/20120613/f9de9153/attachment-0001.sig>


More information about the libvir-list mailing list