From owner-svn-src-head@FreeBSD.ORG Wed Mar 18 18:08:17 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BAAB1065829; Wed, 18 Mar 2009 18:08:17 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 4B8A58FC18; Wed, 18 Mar 2009 18:08:17 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (pool-98-109-39-197.nwrknj.fios.verizon.net [98.109.39.197]) by cyrus.watson.org (Postfix) with ESMTPSA id D23D946B88; Wed, 18 Mar 2009 14:08:16 -0400 (EDT) Received: from localhost (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n2II7TK0007423; Wed, 18 Mar 2009 14:08:10 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Kostik Belousov Date: Wed, 18 Mar 2009 12:15:22 -0400 User-Agent: KMail/1.9.7 References: <200812181158.mBIBwC50039690@svn.freebsd.org> <49BAA2C6.2000807@FreeBSD.org> <20090313212229.GW41617@deviant.kiev.zoral.com.ua> In-Reply-To: <20090313212229.GW41617@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903181215.23213.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Wed, 18 Mar 2009 14:08:11 -0400 (EDT) X-Virus-Scanned: ClamAV 0.94.2/9130/Wed Mar 18 09:51:53 2009 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r186276 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Mar 2009 18:08:18 -0000 On Friday 13 March 2009 5:22:29 pm Kostik Belousov wrote: > On Fri, Mar 13, 2009 at 02:15:34PM -0400, John Baldwin wrote: > > Konstantin Belousov wrote: > > >Author: kib > > >Date: Thu Dec 18 11:58:12 2008 > > >New Revision: 186276 > > >URL: http://svn.freebsd.org/changeset/base/186276 > > > > > >Log: > > > Do not return success and doomed vnode from lookup. LK_UPGRADE allows > > > the vnode to be reclaimed. > > > > > > Tested by: pho > > > MFC after: 1 month > > > > Would EBADF be more appropriate? That is what other places that check > > VI_DOOMED return for this type of check (e.g. in cache_lookup()). > > I do not think so. When we do namei lookup, there is actually no > file descriptor to be invalid. The fact the we lost the race with > forced unmount actually means that there is no more node with > supplied name. Hmm, I think a few places need to be fixed to ENOENT instead of EBADF then: --- //depot/user/jhb/lock/kern/vfs_cache.c +++ /home/jhb/work/p4/lock/kern/vfs_cache.c @@ -315,7 +315,7 @@ * (negative cacheing), a status of ENOENT is returned. If the lookup * fails, a status of zero is returned. If the directory vnode is * recycled out from under us due to a forced unmount, a status of - * EBADF is returned. + * ENOENT is returned. * * vpp is locked and ref'd on return. If we're looking up DOTDOT, dvp is * unlocked. If we're looking up . an extra ref is taken, but the lock is @@ -467,7 +467,7 @@ /* forced unmount */ vrele(*vpp); *vpp = NULL; - return (EBADF); + return (ENOENT); } } else vn_lock(*vpp, LK_DOWNGRADE | LK_RETRY); @@ -974,7 +974,7 @@ if (vp->v_vflag & VV_ROOT) { if (vp->v_iflag & VI_DOOMED) { /* forced unmount */ CACHE_RUNLOCK(); - error = EBADF; + error = ENOENT; break; } vp = vp->v_mount->mnt_vnodecovered; --- //depot/user/jhb/lock/kern/vfs_lookup.c +++ /home/jhb/work/p4/lock/kern/vfs_lookup.c @@ -602,7 +602,7 @@ if ((dp->v_vflag & VV_ROOT) == 0) break; if (dp->v_iflag & VI_DOOMED) { /* forced unmount */ - error = EBADF; + error = ENOENT; goto bad; } tdp = dp; @@ -764,9 +764,11 @@ *ndp->ni_next == '/')) { cnp->cn_flags |= ISSYMLINK; if (dp->v_iflag & VI_DOOMED) { - /* We can't know whether the directory was mounted with - * NOSYMFOLLOW, so we can't follow safely. */ - error = EBADF; + /* + * We can't know whether the directory was mounted with + * NOSYMFOLLOW, so we can't follow safely. + */ + error = ENOENT; goto bad2; } if (dp->v_mount->mnt_flag & MNT_NOSYMFOLLOW) { -- John Baldwin