From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 1157C480 for ; Fri, 31 Jul 2015 17:06:10 +0000 (UTC) Received: from mail-pa0-f46.google.com (mail-pa0-f46.google.com [209.85.220.46]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 8707023F for ; Fri, 31 Jul 2015 17:05:28 +0000 (UTC) Received: by pachj5 with SMTP id hj5so43665836pac.3 for ; Fri, 31 Jul 2015 10:05:28 -0700 (PDT) Date: Fri, 31 Jul 2015 10:05:23 -0700 From: Dmitry Torokhov To: James Bottomley Message-ID: <20150731170523.GF5613@dtor-ws> References: <2111196.TG1k3f53YQ@avalon> <20150731165346.GA18984@infradead.org> <1438362159.2179.42.camel@HansenPartnership.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1438362159.2179.42.camel@HansenPartnership.com> Cc: Christoph Hellwig , Tejun Heo , Russell King , ksummit-discuss@lists.linuxfoundation.org, Shuah Khan Subject: Re: [Ksummit-discuss] [TECH TOPIC] Fix devm_kzalloc, its users, or both List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Fri, Jul 31, 2015 at 10:02:39AM -0700, James Bottomley wrote: > On Fri, 2015-07-31 at 09:53 -0700, Christoph Hellwig wrote: > > On Fri, Jul 31, 2015 at 06:34:21PM +0200, Julia Lawall wrote: > > > How is this different from the free happening explicitly in the remove > > > function? > > > > It's not. The real problem is that people don't understand life time > > rules and expect magic interfaces to fix it for them. > > So surely the rule is that we do this in module removal. That doesn't > get called until last put on the module and that can't happen (or > shouldn't happen) while userspace is holding open one of the /sys > or /proc interfaces (usually those objects hold a reference on something > within the driver to prevent this). > > There is an alternative way of handling this: that would be to detach > the file from the backing interface at _del time, so sysfs/kernfs would > take over the interface and return -ENODEV or something meaning we > could tear down the module even if there was an open interface file. > I'm not advocating this as a solution because I can already see the > problems (like how do you switch interfaces atomically) but if this > really is a serious problem, we should explore alternative solutions. Tejun already done such "switching" for sysfs so it should be possible, however (blasphemy!) there are other entities than files that also may have different lifetime rules that live past device unbinding. Thanks. -- Dmitry