From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59640) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SuEUR-00016x-CE for qemu-devel@nongnu.org; Wed, 25 Jul 2012 23:11:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SuEUQ-00015Y-72 for qemu-devel@nongnu.org; Wed, 25 Jul 2012 23:11:51 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:43606) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SuEUP-00015Q-WD for qemu-devel@nongnu.org; Wed, 25 Jul 2012 23:11:50 -0400 Received: from /spool/local by e39.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 25 Jul 2012 21:11:47 -0600 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 48C6F1FF001B for ; Thu, 26 Jul 2012 03:11:22 +0000 (WET) Received: from d03av05.boulder.ibm.com (d03av05.boulder.ibm.com [9.17.195.85]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q6Q3BOAO142616 for ; Wed, 25 Jul 2012 21:11:24 -0600 Received: from d03av05.boulder.ibm.com (loopback [127.0.0.1]) by d03av05.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q6Q3BN6Y012808 for ; Wed, 25 Jul 2012 21:11:24 -0600 Message-ID: <5010B556.8030402@linux.vnet.ibm.com> Date: Wed, 25 Jul 2012 23:11:18 -0400 From: Corey Bryant MIME-Version: 1.0 References: <1343048885-1701-1-git-send-email-coreyb@linux.vnet.ibm.com> <1343048885-1701-5-git-send-email-coreyb@linux.vnet.ibm.com> <5010476C.9050405@redhat.com> In-Reply-To: <5010476C.9050405@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v5 4/6] block: Convert open calls to qemu_open 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, lcapitulino@redhat.com On 07/25/2012 03:22 PM, Eric Blake wrote: > On 07/23/2012 07:08 AM, Corey Bryant wrote: >> This patch converts all block layer open calls to qemu_open. >> >> Note that this adds the O_CLOEXEC flag to the changed open paths >> when the O_CLOEXEC macro is defined. > > Is it actually adding O_CLOEXEC, or just the ability to use O_CLOEXEC? It is adding O_CLOEXEC in qemu_open() on the open() call (as long as it is defined). > > Or is the actual change that the end result is that the fd now has > FD_CLOEXEC set unconditionally, whether by O_CLOEXEC (which the caller > need not pass) or by fcntl()? > The statement in the commit message isn't referring to anything dealing with qemu_dup(). The statement is specifically talking about the open() call in qemu_open(), and the point is to alert folks that old open() calls are now being routed through qemu_open() and likely are using the O_CLOEXEC flag, which is new behavior. >> +++ b/block/raw-posix.c >> @@ -572,8 +572,8 @@ static int raw_create(const char *filename, QEMUOptionParameter *options) >> options++; >> } >> >> - fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, >> - 0644); >> + fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, >> + 0644); > > After all, I don't see O_CLOEXEC used here. > That's right. qemu_open() adds O_CLOEXEC on the open() call. >> if (fd < 0) { >> result = -errno; >> } else { >> @@ -846,7 +846,7 @@ static int hdev_open(BlockDriverState *bs, const char *filename, int flags) >> if ( bsdPath[ 0 ] != '\0' ) { >> strcat(bsdPath,"s0"); >> /* some CDs don't have a partition 0 */ >> - fd = open(bsdPath, O_RDONLY | O_BINARY | O_LARGEFILE); >> + fd = qemu_open(bsdPath, O_RDONLY | O_BINARY | O_LARGEFILE); > > Also, I still stand by my earlier claim that we don't need O_LARGEFILE > here (we should already be configuring for 64-bit off_t by default), > although cleaning that up is probably worth an independent commit. > I have a note to get rid of O_LARGEFILE as a separate follow-on patch. > >> +++ b/block/vdi.c >> @@ -653,8 +653,9 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options) >> options++; >> } >> >> - fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_LARGEFILE, >> - 0644); >> + fd = qemu_open(filename, >> + O_WRONLY | O_CREAT | O_TRUNC | O_BINARY | O_LARGEFILE, >> + 0644); > > Another pointless O_LARGEFILE, and so forth. > Yep. -- Regards, Corey