From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [RFC] freeing unlinked file indefinitely delayed Date: Sun, 12 Jul 2015 16:00:35 +0100 Message-ID: <20150712150035.GJ17109@ZenIV.linux.org.uk> References: <20150708014237.GC17109@ZenIV.linux.org.uk> <20150708154143.GG4015@sgi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Linus Torvalds , "J. Bruce Fields" , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org To: Ben Myers Return-path: Content-Disposition: inline In-Reply-To: <20150708154143.GG4015@sgi.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Wed, Jul 08, 2015 at 10:41:43AM -0500, Ben Myers wrote: > The bug rings a bell for me so I will stick my neck out instead of > lurking. Don't you need to sample that link count under the filesystems > internal lock in order to avoid an unlink/iget race? I suggest creating > a helper to prune disconnected dentries which a filesystem could call in > .unlink. That would avoid the risk of unintended side effects with the > d_alloc/d_free/icache approach and have provable link count correctness. For one thing, this patch does *not* check for i_nlink at all. For another, there's no such thing as 'filesystems internal lock' for i_nlink protection - that's handled by i_mutex... And what does iget() have to do with any of that?