Subject: Re: namei(".") behaviour
To: None <firstname.lastname@example.org>
From: Juergen Hannken-Illjes <email@example.com>
Date: 07/29/2003 20:18:19
On Tue, Jul 29, 2003 at 06:26:44PM +0200, Juergen Hannken-Illjes wrote:
> While looking over the filesystem snapshot code from FreeBSD I discovered a
> somewhat strange behaviour of namei():
> If called for a DOT directory ("." or "...path/.") it returns with
> nd.ni_dvp == nd.ni_vp
> Even if called with LOCKPARENT flag both (identical) vnodes are not locked.
> This leads to a bunch of code like
> if (nd.ni_dvp == nd.ni_vp)
> Is there a reason why the parent directory (nd.ni_dvp) is returned unlocked?
> If the parent directory was locked this code would become as simple as
To follow up myself...
With Rev. 1.23 (mycroft) of kern/vfs_lookup.c a check for degenerate name
was removed. This check (in lookup) returned:
ENOTDIR if the last component was "" and not a directory
EISDIR if the last component was "" and mode != LOOKUP
Juergen Hannken-Illjes - firstname.lastname@example.org - TU Braunschweig (Germany)