question about vfs_lookup
Pawel Jakub Dawidek
pjd at FreeBSD.org
Sat Feb 17 21:04:43 UTC 2007
On Fri, Feb 16, 2007 at 11:56:40PM -0600, Eric Anderson wrote:
> I'm just curious about how this block (starting at line 712) could possibly ever get executed, since right before it there is a condition that would cause a panic.
>
> Can anyone explain this please?
You read KASSERT(9) in a wrong way. The condition used in assertion says
"don't panic if the condition is true". Here we panic when flag ISLASTCN
is not set and *ndp->ni_next is not equal to '/'.
> In sys/kern/vfs_lookup.c:
> 710 KASSERT((cnp->cn_flags & ISLASTCN) || *ndp->ni_next == '/',
> 711 ("lookup: invalid path state."));
> 712 if (*ndp->ni_next == '/') {
> 713 cnp->cn_nameptr = ndp->ni_next;
> 714 while (*cnp->cn_nameptr == '/') {
> 715 cnp->cn_nameptr++;
> 716 ndp->ni_pathlen--;
> 717 }
> 718 if (ndp->ni_dvp != dp)
> 719 vput(ndp->ni_dvp);
> 720 else
> 721 vrele(ndp->ni_dvp);
> 722 VFS_UNLOCK_GIANT(dvfslocked);
> 723 dvfslocked = vfslocked; /* dp becomes dvp in dirloop */
> 724 vfslocked = 0;
> 725 goto dirloop;
> 726 }
--
Pawel Jakub Dawidek http://www.wheel.pl
pjd at FreeBSD.org http://www.FreeBSD.org
FreeBSD committer Am I Evil? Yes, I Am!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-fs/attachments/20070217/1406b906/attachment.pgp
More information about the freebsd-fs
mailing list