From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 28 17:49:42 2010 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0CB5106564A for ; Sun, 28 Feb 2010 17:49:42 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from gw03.mail.saunalahti.fi (gw03.mail.saunalahti.fi [195.197.172.111]) by mx1.freebsd.org (Postfix) with ESMTP id 5F4908FC35 for ; Sun, 28 Feb 2010 17:49:42 +0000 (UTC) Received: from a91-153-117-195.elisa-laajakaista.fi (a91-153-117-195.elisa-laajakaista.fi [91.153.117.195]) by gw03.mail.saunalahti.fi (Postfix) with SMTP id DB08321683E; Sun, 28 Feb 2010 19:49:37 +0200 (EET) Date: Sun, 28 Feb 2010 19:49:37 +0200 From: Jaakko Heinonen To: Bruce Evans Message-ID: <20100228174936.GA1252@a91-153-117-195.elisa-laajakaista.fi> References: <6413.1266433105@critter.freebsd.dk> <20100218064545.J2074@besplex.bde.org> <20100218095538.GA2318@a91-153-117-195.elisa-laajakaista.fi> <20100225195138.GA3323@a91-153-117-195.elisa-laajakaista.fi> <20100226091923.X2605@delplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100226091923.X2605@delplex.bde.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-hackers@FreeBSD.org, Poul-Henning Kamp Subject: namei() returns EISDIR for "/" (Re: svn commit: r203990 - head/lib/libc/sys) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Feb 2010 17:49:42 -0000 [Moving discussion to -hackers. This is not directly related to the original commit anymore.] On 2010-02-26, Bruce Evans wrote: > > http://people.freebsd.org/~jh/patches/lookup-root.diff > This is in relookup(). I think relookup() is only called from rename(), > so the failing case is unreachable I don't think it's true for unionfs. Looking at the code it seems that it can call relookup() also with CREATE and DELETE nameiops. > % @@ -3618,9 +3618,6 @@ kern_renameat(struct thread *td, int old > % if (fromnd.ni_vp->v_type == VDIR) > % tond.ni_cnd.cn_flags |= WILLBEDIR; > % if ((error = namei(&tond)) != 0) { > % - /* Translate error code for rename("dir1", "dir2/."). */ > % - if (error == EISDIR && fvp->v_type == VDIR) > % - error = EINVAL; > > I think this has nothing to do with the root directory (as its comment says), > but it is to translate the EISDIR returned by ufs_lookup(), etc., when `tond' > is for a (directory) pathname ending in ".". So it should not be removed, > except possibly after changing ufs_lookup(), etc., to return EINVAL. The > EISDIR in ufs_lookup() is only for RENAME, so it is strange that any > translation is needed. I apparently put the translation here to avoid > looking at all leaf file systems. After r199137 the case of "dir2/." is handled in lookup() before the VOP_LOOKUP() call. I am not sure if it should be removed but it seems that there's no need for the translation after r199137. -- Jaakko