From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:51103 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751020AbdKIQCZ (ORCPT ); Thu, 9 Nov 2017 11:02:25 -0500 Subject: Re: [PATCH 3/3] VFS: close race between getcwd() and d_move() To: Matthew Wilcox Cc: NeilBrown , Al Viro , linux-fsdevel@vger.kernel.org, Linus Torvalds , linux-kernel@vger.kernel.org References: <151019756744.30101.3832608128627682973.stgit@noble> <151019772763.30101.16040338743875884111.stgit@noble> <076c5402-b2ff-2d29-2e38-2c0cb69e89b2@suse.com> <20171109130854.GB1094@bombadil.infradead.org> From: Nikolay Borisov Message-ID: <3ef26bf7-c5ea-1af4-b40f-308bcb4e9ce6@suse.com> Date: Thu, 9 Nov 2017 18:02:21 +0200 MIME-Version: 1.0 In-Reply-To: <20171109130854.GB1094@bombadil.infradead.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 9.11.2017 15:08, Matthew Wilcox wrote: > On Thu, Nov 09, 2017 at 01:41:24PM +0200, Nikolay Borisov wrote: >> On 9.11.2017 05:22, NeilBrown wrote: >>> @@ -493,12 +496,18 @@ void __d_drop(struct dentry *dentry) >>> } else >>> hlist_bl_lock(b); >>> __hlist_bl_del(&dentry->d_hash); >>> - dentry->d_hash.pprev = NULL; >>> + if (likely(!moving)) >>> + dentry->d_hash.pprev = NULL; >> >> nit: isn't a bit more explicit if (unlikely(moving)). I suspect the end >> result is the same, however it's easy to miss the !. It's not a big deal >> but just wondering. > > umm ... you just suggested the exact opposite of what the patch is > intended to do. likely()/unlikely() only hint to the compiler the > probabilities of the branch; they don't change the meaning of the > condition. brainfart, disregard my comment doh.... > >