From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Chinner Subject: Re: [PATCH 02/46] fs: d_validate fixes Date: Thu, 9 Dec 2010 11:50:29 +1100 Message-ID: <20101209005029.GC32766@dastard> References: <0fff695735c9b652a3f63b8480686c64811e89d0.1290852958.git.npiggin@kernel.dk> <20101208015344.GE29333@dastard> <20101208065955.GA14846@amd> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: Nick Piggin Return-path: Received: from bld-mail16.adl2.internode.on.net ([150.101.137.101]:44524 "EHLO mail.internode.on.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750930Ab0LIAuf (ORCPT ); Wed, 8 Dec 2010 19:50:35 -0500 Content-Disposition: inline In-Reply-To: <20101208065955.GA14846@amd> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, Dec 08, 2010 at 05:59:55PM +1100, Nick Piggin wrote: > On Wed, Dec 08, 2010 at 12:53:44PM +1100, Dave Chinner wrote: > > On Sat, Nov 27, 2010 at 08:44:32PM +1100, Nick Piggin wrote: > > > d_validate has been broken for a long time. > > >=20 > > > kmem_ptr_validate does not guarantee that a pointer can be derefe= renced > > > if it can go away at any time. Even rcu_read_lock doesn't help, b= ecause > > > the pointer might be queued in RCU callbacks but not executed yet= =2E > > >=20 > > > So the parent cannot be checked, nor the name hashed. The dentry = pointer > > > can not be touched until it can be verified under lock. Hashing s= imply > > > cannot be used. > > >=20 > > > Instead, verify the parent/child relationship by traversing paren= t's > > > d_child list. It's slow, but only ncpfs and the destaged smbfs ca= re > > > about it, at this point. > >=20 > > I'd drop the previous revert patch and just convert the RCU hash > > traversal straight to the d_child traversal code you introduce here= =2E > > This is a much better explanation of why the d_validate mechanism > > needs to be changed, and the revert is really an unnecessary extra > > step... >=20 > Has to be backported, though. Backported where? The d_validate() change only got included in .37-rc1. > Patch that is to be reverted obviously > adds more brokenness and is a good example that you cannot dget() und= er > rcu read protection even if the rest of the surrounding function is > bugfree. I wouldn't have thought it's a big deal. Reverting something broken to something already broken just to fix to the less broken version seems like an unnecessary step. Just fix the brokenne=D1=95s in a single patch - no need to indirect the rea= l fix through a revert. One less patch to worry about. Cheers, Dave. --=20 Dave Chinner david@fromorbit.com -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html