From owner-svn-src-head@FreeBSD.ORG Wed Mar 18 21:02:00 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 BBDE6106566C; Wed, 18 Mar 2009 21:02:00 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.terabit.net.ua (mail.terabit.net.ua [195.137.202.147]) by mx1.freebsd.org (Postfix) with ESMTP id 5565D8FC12; Wed, 18 Mar 2009 21:02:00 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from skuns.zoral.com.ua ([91.193.166.194] helo=mail.zoral.com.ua) by mail.terabit.net.ua with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1Lk2ti-0007jP-UU; Wed, 18 Mar 2009 23:01:59 +0200 Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n2IL1kFN035777 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 18 Mar 2009 23:01:46 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n2IL1kY9011334; Wed, 18 Mar 2009 23:01:46 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n2IL1kNR011333; Wed, 18 Mar 2009 23:01:46 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 18 Mar 2009 23:01:46 +0200 From: Kostik Belousov To: John Baldwin Message-ID: <20090318210146.GG7716@deviant.kiev.zoral.com.ua> References: <200812181158.mBIBwC50039690@svn.freebsd.org> <49BAA2C6.2000807@FreeBSD.org> <20090313212229.GW41617@deviant.kiev.zoral.com.ua> <200903181215.23213.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="QWpDgw58+k1mSFBj" Content-Disposition: inline In-Reply-To: <200903181215.23213.jhb@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua X-Virus-Scanned: mail.terabit.net.ua 1Lk2ti-0007jP-UU ff02edea1678b6c9413a12e355346f4e X-Terabit: YES 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 21:02:01 -0000 --QWpDgw58+k1mSFBj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 18, 2009 at 12:15:22PM -0400, John Baldwin wrote: > 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 all= ows > > > > the vnode to be reclaimed. > > > > =20 > > > > Tested by: pho > > > > MFC after: 1 month > > >=20 > > > Would EBADF be more appropriate? That is what other places that chec= k=20 > > > VI_DOOMED return for this type of check (e.g. in cache_lookup()). > >=20 > > 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. >=20 > Hmm, I think a few places need to be fixed to ENOENT instead of EBADF the= n: >=20 > --- //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 =3D 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 =3D EBADF; > + error =3D ENOENT; > break; > } > vp =3D 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) =3D=3D 0) > break; > if (dp->v_iflag & VI_DOOMED) { /* forced unmount */ > - error =3D EBADF; > + error =3D ENOENT; > goto bad; > } > tdp =3D dp; > @@ -764,9 +764,11 @@ > *ndp->ni_next =3D=3D '/')) { > cnp->cn_flags |=3D 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 =3D EBADF; > + /* > + * We can't know whether the directory was mounted with > + * NOSYMFOLLOW, so we can't follow safely. > + */ > + error =3D ENOENT; > goto bad2; > } > if (dp->v_mount->mnt_flag & MNT_NOSYMFOLLOW) { >=20 There is one place in lookup() that does MNT_UNION handling, it switches to the covered directory when VOP_LOOKUP returns ENOENT. In current code, EBADF from VOP_LOOKUP would cause namei to return, but with the change, it will continue. I doubt that this can cause a problem. Overall, it looks good to me. --QWpDgw58+k1mSFBj Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAknBYTkACgkQC3+MBN1Mb4hHpwCfetOfFkK8nJPRtZnYc1rYsWTZ TRMAni18qQGC4JYrrn35L/5mjERHFbma =Dm5Q -----END PGP SIGNATURE----- --QWpDgw58+k1mSFBj--