From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S267574AbUBSVmj (ORCPT ); Thu, 19 Feb 2004 16:42:39 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S267317AbUBSVmj (ORCPT ); Thu, 19 Feb 2004 16:42:39 -0500 Received: from fw.osdl.org ([65.172.181.6]:60393 "EHLO mail.osdl.org") by vger.kernel.org with ESMTP id S267574AbUBSVkq (ORCPT ); Thu, 19 Feb 2004 16:40:46 -0500 Date: Thu, 19 Feb 2004 13:45:32 -0800 (PST) From: Linus Torvalds To: viro@parcelfarce.linux.theplanet.co.uk cc: Tridge , Jamie Lokier , "H. Peter Anvin" , Kernel Mailing List Subject: Re: Eureka! (was Re: UTF-8 and case-insensitivity) In-Reply-To: Message-ID: References: <20040219081027.GB4113@mail.shareable.org> <20040219163838.GC2308@mail.shareable.org> <20040219182948.GA3414@mail.shareable.org> <20040219200554.GE31035@parcelfarce.linux.theplanet.co.uk> <20040219204515.GG31035@parcelfarce.linux.theplanet.co.uk> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 19 Feb 2004, Linus Torvalds wrote: > > See? Nobody actually ever sees the "raw dentry". They all go through > __d_lookup(), and the rule would be: > > - if "d_lookup()" sees a tentative dentry, it will just unhash it and > drop it (it has the dcache lock, so it can do that) > - all callers of "__d_lookup()" will have to check for D_TENTATIVE, and > decide what to do with it. I think there are exactly _three_ callers, > and one of them is d_lookup() itself. Actually, I've got a better setup: instead of having a D_TENTATIVE flag in the dentry flags, just do #define TENTATIVE_INODE ((struct inode *) 1) and just have "dentry->d_inode = TENTATIVE_INODE" for the dentries that were filled directly from "readdir()" data. This not only avoids using a bit in the dentry flags, but it pretty much guarantees that everybody is forced to use them correctly. It would be very hard to have a buggy user: the dentry will clearly not be a negative dentry (since d_inode is not NULL), but if anybody ever uses it as a positive dentry, you'll get a nice and immediate oops. So we'd see very quickly if these tentative dentries were to escape outside of __d_lookup(). Linus