From owner-freebsd-current@FreeBSD.ORG Mon Mar 9 20:52:03 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D54B610656F9; Mon, 9 Mar 2009 20:52:03 +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 7994B8FC13; Mon, 9 Mar 2009 20:52:03 +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 1LgmSA-00077n-Da; Mon, 09 Mar 2009 22:52:02 +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 n29Kq260014358 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 9 Mar 2009 22:52:02 +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 n29Kq18i074350; Mon, 9 Mar 2009 22:52:01 +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 n29Kq0Lt074349; Mon, 9 Mar 2009 22:52:00 +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: Mon, 9 Mar 2009 22:52:00 +0200 From: Kostik Belousov To: John Baldwin Message-ID: <20090309205200.GY41617@deviant.kiev.zoral.com.ua> References: <3a142e750903090615t63a594e8rbadd7f7231049180@mail.gmail.com> <200903091642.25311.jhb@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5H4PyCrLBLHHAoJp" Content-Disposition: inline In-Reply-To: <200903091642.25311.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-Virus-Scanned: mail.terabit.net.ua 1LgmSA-00077n-Da 5edb8c148ba8391fb55f5654a027ca3d X-Terabit: YES Cc: freebsd-current@freebsd.org Subject: Re: nullfs: panic: vrele: negative ref cnt X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Mar 2009 20:52:05 -0000 --5H4PyCrLBLHHAoJp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 09, 2009 at 04:42:25PM -0400, John Baldwin wrote: > On Monday 09 March 2009 9:15:22 am Paul B. Mahol wrote: > > Hi, > > here is part of textdump: > >=20 > > panic(c061db9e,0,c061cee6,88e,4,...) at panic+0x136 > > vrele(c4326d9c,0,c433fb5f,82,c060f3c7,...) at vrele+0x111 > > null_nodeget(c3fd4780,c4326d9c,c3ba8bf4,0,c3ba8be4,...) at null_nodeget= +0xa0 > > null_bypass(c3ba8be0,c3f35a78,c3ba8c28) at null_bypass+0x141 > > VOP_VPTOCNP_APV(c4340240,c3ba8be0,c061bf01,387,c3cecc00,...) at > > VOP_VPTOCNP_APV+0xb3 >=20 > Try this. null_bypass() can't handle VOP_VPTOCNP because VPTOCNP doesn't= =20 > return a vnode that is locked and VREF'd, but just a vnode that is vhold(= )'d. =20 > This patch attempts to give nullfs a VOP_VPTONCP() method which remaps th= e=20 > directory vnode properly on return by locking the directory vnode while= =20 > invoking null_nodeget(). >=20 > --- //depot/user/jhb/lock/fs/nullfs/null_vnops.c > +++ /home/jhb/work/p4/lock/fs/nullfs/null_vnops.c > @@ -722,6 +722,34 @@ > return VOP_VPTOFH(lvp, ap->a_fhp); > } > =20 > +static int > +null_vptocnp(struct vop_vptocnp_args *ap) > +{ > + struct vnode *lvp, *dvp; > + int error; > + > + /* > + * We can't use null_bypass() because 'dvp' is not returned > + * locked. It is merely 'vhold()'ed. > + */ > + lvp =3D NULLVPTOLOWERVP(ap->a_vp); > + error =3D VOP_VPTOCNP(lvp, &dvp, ap->a_buf, ap->a_buflen); > + if (error) > + return (error); > + > + /* > + * Map 'dvp' to the corresponding null node. We have to lock > + * it before calling null_nodeget(). > + */ > + vn_lock(dvp, LK_SHARED | LK_RETRY); > + error =3D null_nodeget(ap->a_vp->v_mount, dvp, ap->a_vpp); > + if (error) { > + vrele(dvp); > + vdrop(dvp); > + } > + return (error); > +} > + > /* > * Global vfs data structures > */ > @@ -743,4 +771,5 @@ > .vop_strategy =3D VOP_EOPNOTSUPP, > .vop_unlock =3D null_unlock, > .vop_vptofh =3D null_vptofh, > + .vop_vptocnp =3D null_vptocnp, > }; I do not think that nullfs-specific method is needed. I already mailed the following patch to the reporters. diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 5a6823f..38da43f 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -742,5 +742,6 @@ struct vop_vector null_vnodeops =3D { .vop_setattr =3D null_setattr, .vop_strategy =3D VOP_EOPNOTSUPP, .vop_unlock =3D null_unlock, + .vop_vptocnp =3D vop_stdvptocnp, .vop_vptofh =3D null_vptofh, }; --5H4PyCrLBLHHAoJp Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkm1gXAACgkQC3+MBN1Mb4gZFQCg38LpMXxdRi0F8d4O8jv0TCth D2MAoOlIGNFyJORNeidhaNV6dWb16BQT =lbJC -----END PGP SIGNATURE----- --5H4PyCrLBLHHAoJp--