From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [git pull] vfs.git spurious ENOTDIR fix Date: Sun, 2 Aug 2015 05:39:47 +0100 Message-ID: <20150802043947.GB17109@ZenIV.linux.org.uk> References: <20150731205036.GA3752@nautica> <20150801072603.GV17109@ZenIV.linux.org.uk> <20150802001402.GY17109@ZenIV.linux.org.uk> <20150802002318.GZ17109@ZenIV.linux.org.uk> <20150802014139.GA17109@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Linus Torvalds , Dominique Martinet , "J. Bruce Fields" , Dominique Martinet , Linux Kernel Mailing List , linux-fsdevel , David Howells To: Hugh Dickins Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Sat, Aug 01, 2015 at 09:06:55PM -0700, Hugh Dickins wrote: > (I don't actually understand why the clearing of DCACHE_ENTRY_TYPE in > dentry_iput() is not of continuing concern; but don't worry, there's > plenty I don't understand - so long as you're both satisfied that > it's not a concern, no need to persuade me.) Because before we even get to dentry_iput(), we evict the fucker from hash. And that will do dentry_rcuwalk_invalidate(dentry), which will bump ->d_seq *AFTER* having it unhashed. Now look at __d_lookup_rcu() - there we fetch ->d_seq, then verify that it's still hashed. So having hit dentry_iput() means that everyone who'd found it via RCU lookup will be guaranteed a ->d_seq mismatch. The same goes for things like d_drop() and d_instantiate(). Look for dentry_rcuwalk_invalidate() callers in there... Clearing DCACHE_ENTRY_TYPE there is fine - dentry *is* made negative there, after all. What we want is to have ->d_inode stable at least as long as ->d_seq remains so.