From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zeniv.linux.org.uk ([195.92.253.2]:48306 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751372AbdKUXvA (ORCPT ); Tue, 21 Nov 2017 18:51:00 -0500 Date: Tue, 21 Nov 2017 23:50:58 +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: <20171121235057.GA19523@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> <20171110205328.GH21978@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171110205328.GH21978@ZenIV.linux.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, Nov 10, 2017 at 08:53:28PM +0000, Al Viro wrote: > 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... OK, I believe that it's survivable, but I'd prefer to keep in -next for a while and give it more testing.