From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:47315) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sevl3-0003vk-FR for qemu-devel@nongnu.org; Wed, 13 Jun 2012 18:09:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sevl1-0000bm-PK for qemu-devel@nongnu.org; Wed, 13 Jun 2012 18:09:45 -0400 Received: from e34.co.us.ibm.com ([32.97.110.152]:38397) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sevl1-0000b4-IX for qemu-devel@nongnu.org; Wed, 13 Jun 2012 18:09:43 -0400 Received: from /spool/local by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 13 Jun 2012 16:09:39 -0600 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 93B9B19D804E for ; Wed, 13 Jun 2012 22:08:31 +0000 (WET) Received: from d03av06.boulder.ibm.com (d03av06.boulder.ibm.com [9.17.195.245]) by d03relay04.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q5DM800Y154504 for ; Wed, 13 Jun 2012 16:08:16 -0600 Received: from d03av06.boulder.ibm.com (loopback [127.0.0.1]) by d03av06.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q5DM8d6k004127 for ; Wed, 13 Jun 2012 16:08:39 -0600 Message-ID: <4FD90F2F.5070401@linux.vnet.ibm.com> Date: Wed, 13 Jun 2012 18:07:43 -0400 From: Corey Bryant MIME-Version: 1.0 References: <1339170179-2554-1-git-send-email-coreyb@linux.vnet.ibm.com> <1339170179-2554-3-git-send-email-coreyb@linux.vnet.ibm.com> <20120613164649.04b13706@doriath.home> <4FD8F734.7030301@linux.vnet.ibm.com> <4FD8FC61.1080204@redhat.com> In-Reply-To: <4FD8FC61.1080204@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 2/4] qapi: Add passfd QMP command List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@linux.vnet.ibm.com, libvir-list@redhat.com, qemu-devel@nongnu.org, Luiz Capitulino On 06/13/2012 04:47 PM, Eric Blake wrote: > 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'. Yes, users need to be careful and understand how the commands work. I don't think it's a hard rule that 'getfd' can't be used by an application that uses 'pass-fd'. If it were, we could put the fds on separate lists: struct Monitor { ... QLIST_HEAD(,mon_fd_t) fds; + QLIST_HEAD(,mon_fd_t) pass_fds; }; But I don't think this is necessary, so I'll plan on documenting them well. > > 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. > Ok, I'll mention this too. Thanks. -- Regards, Corey