From owner-freebsd-fs@FreeBSD.ORG Thu Feb 22 22:11:50 2007 Return-Path: X-Original-To: freebsd-fs@freebsd.org Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1BF2316A402; Thu, 22 Feb 2007 22:11:50 +0000 (UTC) (envelope-from anderson@freebsd.org) Received: from mh1.centtech.com (moat3.centtech.com [64.129.166.50]) by mx1.freebsd.org (Postfix) with ESMTP id 5DF0E13C4A3; Thu, 22 Feb 2007 22:11:49 +0000 (UTC) (envelope-from anderson@freebsd.org) Received: from [10.177.171.220] (neutrino.centtech.com [10.177.171.220]) by mh1.centtech.com (8.13.8/8.13.8) with ESMTP id l1MMBmYl045306; Thu, 22 Feb 2007 16:11:48 -0600 (CST) (envelope-from anderson@freebsd.org) Message-ID: <45DE1528.8020902@freebsd.org> Date: Thu, 22 Feb 2007 16:11:52 -0600 From: Eric Anderson User-Agent: Thunderbird 1.5.0.9 (X11/20070204) MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <45D69918.3000008@freebsd.org> <20070217210322.GB64936@garage.freebsd.pl> In-Reply-To: <20070217210322.GB64936@garage.freebsd.pl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV 0.88.4/2630/Thu Feb 22 13:12:40 2007 on mh1.centtech.com X-Virus-Status: Clean X-Spam-Status: No, score=-2.6 required=8.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.6 X-Spam-Checker-Version: SpamAssassin 3.1.6 (2006-10-03) on mh1.centtech.com Cc: "freebsd-fs@freebsd.org" Subject: Re: question about vfs_lookup X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Feb 2007 22:11:50 -0000 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 } >