qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Corey Bryant <coreyb@linux.vnet.ibm.com>
To: Eric Blake <eblake@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com,
	libvir-list@redhat.com, Jeff Cody <jcody@redhat.com>,
	qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>,
	pbonzini@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 0/5] file descriptor passing using pass-fd
Date: Wed, 20 Jun 2012 09:31:11 -0400	[thread overview]
Message-ID: <4FE1D09F.8070704@linux.vnet.ibm.com> (raw)
In-Reply-To: <4FE1B308.2080100@redhat.com>



On 06/20/2012 07:24 AM, Eric Blake wrote:
> On 06/20/2012 02:31 AM, Daniel P. Berrange wrote:
>
>>> This might mean that libvirt should only closefd the file when it
>>> becomes unused (like after hot unplug); or that qemu must keep it open
>>> internally even after closefd as long as the block device is still in use.
>>
>> As it works today, the only time libvirt would call "closefd", is if
>> the monitor command it was trying to use the FD with (eg drive_add)
>> failed. If drive_add was successfully run, then libvirt would not be
>> invoking closefd.
>
> But right now, the only time libvirt uses 'getfd' is with commands like
> 'migrate' that implicitly close the fd after it is used by name; we
> don't have any experience in using fds by '/dev/fd/nn' notation instead
> of name.  It is the fact that /dev/fd/nn will allow us to use 'pass-fd'
> in more situations in before, by dup()ing the fd, that libvirt all the
> sudden becomes responsible for using 'closefd' at the appropriate moments.
>
> I guess I can live with a rule that libvirt must not call 'closefd' on
> any fd that it might later want to reassign to a new copy of the fd;
> that is, with backing chains, if libvirt originally calls 'pass-fd
> drive-virtio1' with an O_RDONLY fd and gets back 21, then libvirt must
> not call 'closefd drive-virtio1' until it knows drive-virtio1 is no
> longer needed.  Converting the 'drive-virtio1' fd to O_RDWR while still
> keeping it at /dev/fd/21 could be done via 'pass-fd -f drive-virtio1',
> where -f is an optional bool parameter to force a reassociation of a
> given name back to the previously assigned value instead of the normal
> error path for accidentally passing an fd to an already in-use name.
>

It sounds like the flow would be:
'pass-fd drive-virtio1' of O_RDONLY fd --> guest gets fd 21
'pass-fd -f drive-virtio1' of O_WRONLY fd --> guest gets fd 21?

But I'm not clear as to how you would retain file descriptor 21 in the 
guest when using 'pass-fd -f drive-virtio1'.  The fd is created as a 
result of passing via SCM_RIGHTS, which assigns the next available fd. 
We don't have control over what fd is assigned, do we?

-- 
Regards,
Corey

  reply	other threads:[~2012-06-20 13:36 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-14 15:55 [Qemu-devel] [PATCH v3 0/5] file descriptor passing using pass-fd Corey Bryant
2012-06-14 15:55 ` [Qemu-devel] [PATCH v3 1/5] qapi: Convert getfd and closefd Corey Bryant
2012-06-14 15:55 ` [Qemu-devel] [PATCH v3 2/5] qapi: Add pass-fd QMP command Corey Bryant
2012-06-15 14:32   ` Luiz Capitulino
2012-06-15 15:04     ` Corey Bryant
2012-06-15 15:14       ` Luiz Capitulino
2012-06-15 15:29         ` Corey Bryant
2012-06-15 16:26           ` Luiz Capitulino
2012-06-14 15:55 ` [Qemu-devel] [PATCH v3 3/5] osdep: Enable qemu_open to dup pre-opened fd Corey Bryant
2012-06-15 15:16   ` Eric Blake
2012-06-15 18:16     ` Corey Bryant
2012-06-15 18:42       ` Eric Blake
2012-06-15 19:02         ` Corey Bryant
2012-06-15 18:46       ` Kevin Wolf
2012-06-15 19:19         ` Corey Bryant
2012-06-15 20:00           ` Eric Blake
2012-06-15 20:49             ` Corey Bryant
2012-06-18  8:10             ` Kevin Wolf
2012-06-19 13:59               ` Corey Bryant
2012-06-14 15:55 ` [Qemu-devel] [PATCH v3 4/5] block: Convert open calls to qemu_open Corey Bryant
2012-06-15 14:36   ` Luiz Capitulino
2012-06-15 15:10     ` Corey Bryant
2012-06-15 15:21   ` Eric Blake
2012-06-15 18:32     ` Corey Bryant
2012-06-14 15:55 ` [Qemu-devel] [PATCH v3 5/5] block: Prevent /dev/fd/X filename from being detected as floppy Corey Bryant
2012-06-15 14:38   ` Luiz Capitulino
2012-06-15 15:12     ` Corey Bryant
2012-06-19 15:46 ` [Qemu-devel] [PATCH v3 0/5] file descriptor passing using pass-fd Eric Blake
2012-06-19 15:57   ` Kevin Wolf
2012-06-19 16:14     ` Eric Blake
2012-06-20  7:25       ` Kevin Wolf
2012-06-20  8:31         ` Daniel P. Berrange
2012-06-20 11:24           ` Eric Blake
2012-06-20 13:31             ` Corey Bryant [this message]
2012-06-20 14:53               ` Eric Blake
2012-06-20 16:24                 ` Corey Bryant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FE1D09F.8070704@linux.vnet.ibm.com \
    --to=coreyb@linux.vnet.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=eblake@redhat.com \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).