From owner-freebsd-current@FreeBSD.ORG Mon Mar 9 22:23:58 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 113FD1065678 for ; Mon, 9 Mar 2009 22:23:58 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-fx0-f158.google.com (mail-fx0-f158.google.com [209.85.220.158]) by mx1.freebsd.org (Postfix) with ESMTP id 666B28FC19 for ; Mon, 9 Mar 2009 22:23:56 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: by fxm2 with SMTP id 2so1324357fxm.43 for ; Mon, 09 Mar 2009 15:23:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=JAtCjKU/294BX+iEWPZZMsAy98k4yyLgzFM8D7YOpyg=; b=d3fwKAi3sD6CXzV06Fc3/yCxJ9eyzOlIDc9i8f9/E2mVikggm+H19FJielnwzQWg3o tPbFr4zYBLxwkogAZt2jDIjo6ORzO4B++hxcq/hSxXNTHmXh3NxBghIGcZX2yC+X0JO3 Adpoanre+g4yhwS9RiAjiWxxyZOGbnpvA0DdU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=kKScTribzamvxCO4kv4ufzP6gJkS3ro1eMuUe4L8npEnsbS5zhrdrwPMsi4c8BuElE OMvrKkWLKKYlGZrTDPf9xwQdFIHlYz8zWMNDwyhW+KIbZa2ZbK9EtM1m6+bRh6ZlH6B0 VBMf86bnhVscvqGaIdFAOqQDPt1QC3C4IcwUA= MIME-Version: 1.0 Sender: asmrookie@gmail.com Received: by 10.223.108.15 with SMTP id d15mr4894108fap.62.1236636229834; Mon, 09 Mar 2009 15:03:49 -0700 (PDT) In-Reply-To: <20090309205200.GY41617@deviant.kiev.zoral.com.ua> References: <3a142e750903090615t63a594e8rbadd7f7231049180@mail.gmail.com> <200903091642.25311.jhb@freebsd.org> <20090309205200.GY41617@deviant.kiev.zoral.com.ua> Date: Mon, 9 Mar 2009 23:03:49 +0100 X-Google-Sender-Auth: b9f1022f33a9207b Message-ID: <3bbf2fe10903091503o758c2a0aif980257a34760c3c@mail.gmail.com> From: Attilio Rao To: Kostik Belousov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 22:23:58 -0000 2009/3/9, Kostik Belousov : > 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: > > > > > > 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 > > > > Try this. null_bypass() can't handle VOP_VPTOCNP because VPTOCNP doesn't > > return a vnode that is locked and VREF'd, but just a vnode that is vhold()'d. > > This patch attempts to give nullfs a VOP_VPTONCP() method which remaps the > > directory vnode properly on return by locking the directory vnode while > > invoking null_nodeget(). > > > > --- //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); > > } > > > > +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 = NULLVPTOLOWERVP(ap->a_vp); > > + error = 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 = 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 = VOP_EOPNOTSUPP, > > .vop_unlock = null_unlock, > > .vop_vptofh = null_vptofh, > > + .vop_vptocnp = 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 = { > .vop_setattr = null_setattr, > > .vop_strategy = VOP_EOPNOTSUPP, > .vop_unlock = null_unlock, > > + .vop_vptocnp = vop_stdvptocnp, > .vop_vptofh = null_vptofh, > }; Speaking of which, I don't think nullfs should redefine null_islocked() but it should choose the standard one. While there you could handle that too? Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein