From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [patch 1/9] procfs: Move /proc/pid/fd[info] handling code to fd.[ch] Date: Sat, 25 Aug 2012 20:12:18 +0100 Message-ID: <20120825191218.GV23464@ZenIV.linux.org.uk> References: <20120823104323.040550004@openvz.org> <20120823104725.592602491@openvz.org> <20120825171605.GT23464@ZenIV.linux.org.uk> <20120825173958.GC19184@moon> <20120825175504.GU23464@ZenIV.linux.org.uk> <20120825185829.GE19184@moon> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Alexey Dobriyan , Andrew Morton , Pavel Emelyanov , James Bottomley , Matthew Helsley , aneesh.kumar@linux.vnet.ibm.com, bfields@fieldses.org To: Cyrill Gorcunov Return-path: Content-Disposition: inline In-Reply-To: <20120825185829.GE19184@moon> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Sat, Aug 25, 2012 at 10:58:29PM +0400, Cyrill Gorcunov wrote: > On Sat, Aug 25, 2012 at 06:55:04PM +0100, Al Viro wrote: > > > Well, this could be simplified indeed, if I understand you correctly > > > you propose just save f_mode in flexible array and use it instead > > > of struct file, right? (which will require to rewrite code a bit) > > > > Yes. FWIW, proc_fill_cache() is really atrocious ;-/ Not to mention > > OK, thanks. I'm putting this cleanup task in my big todo list. Hope I'll > manage on the next week with it. > > > anything else, if we ever get a negative dentry there, we have a dentry > > leak. I don't think it's possible in practice, but... Furthermore, > > could you please elaborate, you mean this string? I mean that if we get to that if (... || !child->d_inode) and end up evaluating the last part at all, we have acquired a reference to that struct dentry. And if that last part ends up being true (i.e. if it's a negative dentry), we'll return from function without having dropped the reference we'd acquired.