From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Bottomley Subject: Re: [PATCH v2] Implement close-on-fork Date: Fri, 15 May 2020 09:25:50 -0700 Message-ID: <1589559950.3653.11.camel@HansenPartnership.com> References: <20200515152321.9280-1-nate.karstens@garmin.com> <20200515155730.GF16070@bombadil.infradead.org> <5b1929aa9f424e689c7f430663891827@garmin.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5b1929aa9f424e689c7f430663891827@garmin.com> Sender: netdev-owner@vger.kernel.org To: "Karstens, Nate" , Matthew Wilcox Cc: Alexander Viro , Jeff Layton , "J. Bruce Fields" , Arnd Bergmann , Richard Henderson , Ivan Kokshaysky , Matt Turner , Helge Deller , "David S. Miller" , Jakub Kicinski , Eric Dumazet , David Laight , "linux-fsdevel@vger.kernel.org" , "linux-arch@vger.kernel.org" , "linux-alpha@vger.kernel.org" , "linux-parisc@vger.kernel.org" , "sparclinux@vger.kernel.org" , netdev@vger.ker List-Id: linux-arch.vger.kernel.org On Fri, 2020-05-15 at 16:07 +0000, Karstens, Nate wrote: > Matthew, > > What alternative would you suggest? > > From an earlier email: > > > ...nothing else addresses the underlying issue: there is no way to > > prevent a fork() from duplicating the resource. The close-on-exec > > flag partially-addresses this by allowing the parent process to > > mark a file descriptor as exclusive to itself, but there is still > > a period of time the failure can occur because the auto-close only > > occurs during the exec(). Perhaps this would not be an issue with > > a different process/threading model, but that is another discussion > > entirely. > > Do you disagree there is an issue? Oh good grief that's a leading question: When I write bad code and it crashes, most people would agree there is an issue; very few would agree the kernel should be changed to fix it. Several of us have already said the problem seems to be with the way your application is written. You didn't even answer emails like this speculating about the cause being the way your application counts resources: https://lore.kernel.org/linux-fsdevel/1587569663.3485.18.camel@HansenPartnership.com/ The bottom line is that we think you could rewrite this one application not to have the problem you're complaining about rather than introduce a new kernel API to "fix" it. James From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bedivere.hansenpartnership.com ([66.63.167.143]:50480 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726023AbgEOQZy (ORCPT ); Fri, 15 May 2020 12:25:54 -0400 Message-ID: <1589559950.3653.11.camel@HansenPartnership.com> Subject: Re: [PATCH v2] Implement close-on-fork From: James Bottomley Date: Fri, 15 May 2020 09:25:50 -0700 In-Reply-To: <5b1929aa9f424e689c7f430663891827@garmin.com> References: <20200515152321.9280-1-nate.karstens@garmin.com> <20200515155730.GF16070@bombadil.infradead.org> <5b1929aa9f424e689c7f430663891827@garmin.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: "Karstens, Nate" , Matthew Wilcox Cc: Alexander Viro , Jeff Layton , "J. Bruce Fields" , Arnd Bergmann , Richard Henderson , Ivan Kokshaysky , Matt Turner , Helge Deller , "David S. Miller" , Jakub Kicinski , Eric Dumazet , David Laight , "linux-fsdevel@vger.kernel.org" , "linux-arch@vger.kernel.org" , "linux-alpha@vger.kernel.org" , "linux-parisc@vger.kernel.org" , "sparclinux@vger.kernel.org" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Changli Gao , "a.josey@opengroup.org" Message-ID: <20200515162550.HztfUcMf06JrOx2GL1pusE6T1IhqrB3LZ8mj4b2Xbwk@z> On Fri, 2020-05-15 at 16:07 +0000, Karstens, Nate wrote: > Matthew, > > What alternative would you suggest? > > From an earlier email: > > > ...nothing else addresses the underlying issue: there is no way to > > prevent a fork() from duplicating the resource. The close-on-exec > > flag partially-addresses this by allowing the parent process to > > mark a file descriptor as exclusive to itself, but there is still > > a period of time the failure can occur because the auto-close only > > occurs during the exec(). Perhaps this would not be an issue with > > a different process/threading model, but that is another discussion > > entirely. > > Do you disagree there is an issue? Oh good grief that's a leading question: When I write bad code and it crashes, most people would agree there is an issue; very few would agree the kernel should be changed to fix it. Several of us have already said the problem seems to be with the way your application is written. You didn't even answer emails like this speculating about the cause being the way your application counts resources: https://lore.kernel.org/linux-fsdevel/1587569663.3485.18.camel@HansenPartnership.com/ The bottom line is that we think you could rewrite this one application not to have the problem you're complaining about rather than introduce a new kernel API to "fix" it. James