namei() returns EISDIR for "/" (Re: svn commit: r203990 - head/lib/libc/sys)

Jaakko Heinonen jh at
Sun Feb 28 17:49:42 UTC 2010

[Moving discussion to -hackers. This is not directly related to the
original commit anymore.]

On 2010-02-26, Bruce Evans wrote:
> >

> 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.


More information about the freebsd-hackers mailing list