From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751360AbdBXRGY (ORCPT ); Fri, 24 Feb 2017 12:06:24 -0500 Received: from merlin.infradead.org ([205.233.59.134]:58862 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751281AbdBXRGK (ORCPT ); Fri, 24 Feb 2017 12:06:10 -0500 Date: Fri, 24 Feb 2017 18:06:06 +0100 From: Peter Zijlstra To: Linus Torvalds Cc: Hans Liljestrand , Al Viro , linux-kernel@vger.kernel.org, dwindsor@gmail.com, David Howells , linux-fsdevel@vger.kernel.org, Chris Mason , gregkh@linuxfoundation.org, elena.reshetova@intel.com Subject: Re: [RFC][PATCH 02/10] fs: Avoid looking at i_count without i_lock held Message-ID: <20170224170606.GR6515@twins.programming.kicks-ass.net> References: <20170224154329.478276481@infradead.org> <20170224162043.988779074@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 24, 2017 at 08:56:06AM -0800, Linus Torvalds wrote: > This one looks very questionable. > > Taking the lock for every single inode, even when we can tell that it's > pointless, is horrid. > > Even if you really think you found a race, i think it would be better to > leave the unlocked read around as an optimistic check, and then do a safe > double check read inside the lock (together with the i_state checks) > > Hmm? Yeah, pretty dumb that.