Date: Sat, 17 Feb 2007 22:03:22 +0100 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: Eric Anderson <anderson@freebsd.org> Cc: "freebsd-fs@freebsd.org" <freebsd-fs@freebsd.org> Subject: Re: question about vfs_lookup Message-ID: <20070217210322.GB64936@garage.freebsd.pl> In-Reply-To: <45D69918.3000008@freebsd.org> References: <45D69918.3000008@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--61jdw2sOBCFtR2d/ Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 possib= ly ever get executed, since right before it there is a condition that would= cause a panic. >=20 > 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 =3D=3D '/= ', > 711 ("lookup: invalid path state.")); > 712 if (*ndp->ni_next =3D=3D '/') { > 713 cnp->cn_nameptr =3D ndp->ni_next; > 714 while (*cnp->cn_nameptr =3D=3D '/') { > 715 cnp->cn_nameptr++; > 716 ndp->ni_pathlen--; > 717 } > 718 if (ndp->ni_dvp !=3D dp) > 719 vput(ndp->ni_dvp); > 720 else > 721 vrele(ndp->ni_dvp); > 722 VFS_UNLOCK_GIANT(dvfslocked); > 723 dvfslocked =3D vfslocked; /* dp becomes dvp in dirloo= p */ > 724 vfslocked =3D 0; > 725 goto dirloop; > 726 } --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --61jdw2sOBCFtR2d/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (FreeBSD) iD8DBQFF122aForvXbEpPzQRAuPXAJ0TObEF1Cb23L+EbDSzYIuVZTriFgCfWZMj Ks8fpKFxdmwyNrj+g+iYDTE= =FHlZ -----END PGP SIGNATURE----- --61jdw2sOBCFtR2d/--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070217210322.GB64936>