From owner-freebsd-current@FreeBSD.ORG Mon Mar 30 15:35:01 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 CC3D31065760; Mon, 30 Mar 2009 15:35:01 +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 878448FC1D; Mon, 30 Mar 2009 15:35:01 +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 1AF8446B38; Mon, 30 Mar 2009 11:35:01 -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 n2UFYVHu023015; Mon, 30 Mar 2009 11:34:54 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: Tim Kientzle Date: Mon, 30 Mar 2009 11:31:43 -0400 User-Agent: KMail/1.9.7 References: <20090312175345.Y80227@rust.salford.ac.uk> <20090317070440.GE2012@garage.freebsd.pl> <49CFA1D9.1020604@freebsd.org> In-Reply-To: <49CFA1D9.1020604@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200903301131.44164.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]); Mon, 30 Mar 2009 11:34:55 -0400 (EDT) X-Virus-Scanned: ClamAV 0.94.2/9180/Sun Mar 29 16:40:14 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: Pawel Jakub Dawidek , Attilio Rao , "freebsd-current@freebsd.org" , Mark Powell , Anonymous , Peter Schuller Subject: Re: repeatable ZFS panic: share->excl 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, 30 Mar 2009 15:35:02 -0000 On Sunday 29 March 2009 12:29:13 pm Tim Kientzle wrote: > Pawel Jakub Dawidek wrote: > > On Fri, Mar 13, 2009 at 02:08:03PM -0400, John Baldwin wrote: > >> John Baldwin wrote: > >>> Yes, I think that is the real bug. Looking at this further I think > >>> zfs_get_xattrdir() will return the vnode locked if it has to create a > >>> new node via zfs_make_attrdir() but only returns it held and unlocked if > >>> it finds an existing one. So my new patch is to just fix > >>> zfs_get_xattrdir() to unlock the vnode if it creates a new one like so: > >>> > >>> (Sorry, TBird is probably going to butcher all the whitespace): > >>> > >>> --- > >>> //depot/user/jhb/lock/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c > >>> +++ > >>> /Users/jhb/work/p4/lock/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c > >>> > >>> @@ -940,6 +940,7 @@ > >>> /* NB: we already did dmu_tx_wait() if necessary */ > >>> goto top; > >>> } > >>> + VOP_UNLOCK(*xvpp, 0); > >>> > >>> return (error); > >>> } > >>> > >>> A non-butchered version is at www.FreeBSD.org/~jhb/patches/zfs_ea.patch. > >> So lulf@ reports success with this patch. Pawel, can you review it? > > > > Yes, it works for me too and looks good. The only thing we need to > > change is to check for error beeing 0 before unlocking the vnode. > > The zfs_make_xattrdir() function can still return with EIO, so I'd add > > something like this: > > > > if (error == 0) > > VOP_UNLOCK(*xvpp, 0); > > > > Thank you John for spending time on tracking this one down. > > Any estimate on when this can be committed? > > I'm waiting to re-enable the extended attribute > archiving support in tar until this is fixed. Err, it went into the tree a while ago: Author: jhb Date: Wed Mar 18 16:19:44 2009 New Revision: 189967 URL: http://svn.freebsd.org/changeset/base/189967 Log: The zfs_get_xattrdir() function is used to find the extended attribute directory for a znode. When the directory already exists, it returns a referenced but unlocked vnode. When a directory does not yet exist, it calls zfs_make_xattrdir() to create a new one. zfs_make_xattrdir() returns the vnode both referenced and and locked and zfs_get_xattrdir() was leaking this vnode lock to its callers. Fix this by dropping the vnode lock if zfs_make_xattrdir() successfully creates a new extended attribute directory. Reviewed by: pjd -- John Baldwin