question about vfs_lookup

Eric Anderson anderson at freebsd.org
Sat Feb 17 05:56:40 UTC 2007


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?


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         }


Thanks!
Eric




More information about the freebsd-fs mailing list