From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sh0om-00061W-H4 for qemu-devel@nongnu.org; Tue, 19 Jun 2012 11:58:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sh0of-00028s-Fn for qemu-devel@nongnu.org; Tue, 19 Jun 2012 11:58:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62913) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sh0of-00028S-7t for qemu-devel@nongnu.org; Tue, 19 Jun 2012 11:58:05 -0400 Message-ID: <4FE0A15F.7070606@redhat.com> Date: Tue, 19 Jun 2012 17:57:19 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1339689305-27031-1-git-send-email-coreyb@linux.vnet.ibm.com> <4FE09EE3.9070603@redhat.com> In-Reply-To: <4FE09EE3.9070603@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 0/5] file descriptor passing using pass-fd List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, libvir-list@redhat.com, Jeff Cody , Corey Bryant , qemu-devel@nongnu.org, Luiz Capitulino , pbonzini@redhat.com Am 19.06.2012 17:46, schrieb Eric Blake: > On 06/14/2012 09:55 AM, Corey Bryant wrote: > >> This patch series adds the pass-fd QMP monitor command, which allows >> an fd to be passed via SCM_RIGHTS, and returns the received file >> descriptor. Support is also added to the block layer to allow QEMU >> to dup the fd when the filename is of the /dev/fd/X format. This >> is useful if MAC policy prevents QEMU from opening specific types >> of files. > > Something to think about on how this will interact with Jeff's work on > block-commit. That is an interface where qemu must reopen backing files > which were previously O_RDONLY to now be O_RDWR. By default (when > open() is supported in qemu, and qemu is using the actual file name), > this means 'block-commit' works without needing any fd names. But with > this new fd-passing approach, a file originally opened as O_RDONLY > /dev/fd/21 will need to be reopened, but the reopened fd will (likely) > not be 21. In other words, we need to make sure 'block-commit' supports > the ability to pass in optional arguments that specify the file name of > the backing file to be reopened, so that libvirt can pass in O_RDWR fds > to replace the existing O_RDONLY fd, and be aware that the /dev/fd/nn > naming of the reopen will be different. Adding an extra argument to each command that reopens (as in bdrv_reopen(), i.e. changes flags) internally is one option. In my opinion not a particularly nice one, though. Maybe it's better to have a monitor command that just prepares a reopen and means "for the next reopen of /dev/fd/42, the passed FD will have the right flags (if it hasn't, the reopen will fail)". We can use dup2() to keep the "name" stable. Kevin