From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zeniv.linux.org.uk ([195.92.253.2]:59492 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753323AbdKJUxc (ORCPT ); Fri, 10 Nov 2017 15:53:32 -0500 Date: Fri, 10 Nov 2017 20:53:28 +0000 From: Al Viro To: NeilBrown Cc: Linus Torvalds , linux-fsdevel , Linux Kernel Mailing List Subject: Re: [PATCH 3/3] VFS: close race between getcwd() and d_move() Message-ID: <20171110205328.GH21978@ZenIV.linux.org.uk> References: <151019756744.30101.3832608128627682973.stgit@noble> <151019772763.30101.16040338743875884111.stgit@noble> <8760ajf6al.fsf@notabene.neil.brown.name> <871sl6eo7e.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <871sl6eo7e.fsf@notabene.neil.brown.name> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, Nov 10, 2017 at 03:45:41PM +1100, NeilBrown wrote: > -void __d_drop(struct dentry *dentry) > +static void ___d_drop(struct dentry *dentry) > { > if (!d_unhashed(dentry)) { > struct hlist_bl_head *b; > @@ -486,12 +488,15 @@ void __d_drop(struct dentry *dentry) > > hlist_bl_lock(b); > __hlist_bl_del(&dentry->d_hash); > - dentry->d_hash.pprev = NULL; > hlist_bl_unlock(b); > /* After this call, in-progress rcu-walk path lookup will fail. */ > write_seqcount_invalidate(&dentry->d_seq); > } > } > +void __d_drop(struct dentry *dentry) { > + ___d_drop(dentry); > + dentry->d_hash.pprev = NULL; Umm... That reordering (unhashed vs. ->d_seq) might be a problem on the RCU side. I'm not sure it is, we might get away with that, actually, but I want to finish digging through the pathwalk-related code. Cursing it for being too subtle for its own good, as usual...