Date: Thu, 22 Feb 2007 16:11:52 -0600 From: Eric Anderson <anderson@freebsd.org> To: Pawel Jakub Dawidek <pjd@freebsd.org> Cc: "freebsd-fs@freebsd.org" <freebsd-fs@freebsd.org> Subject: Re: question about vfs_lookup Message-ID: <45DE1528.8020902@freebsd.org> In-Reply-To: <20070217210322.GB64936@garage.freebsd.pl> References: <45D69918.3000008@freebsd.org> <20070217210322.GB64936@garage.freebsd.pl>
next in thread | previous in thread | raw e-mail | index | archive | help
On 02/17/07 15:03, Pawel Jakub Dawidek wrote: > 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 '/'. That makes a lot more sense now.. Thanks :) Eric >> 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 } >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45DE1528.8020902>