From owner-freebsd-current@FreeBSD.ORG Fri Mar 13 17:28:51 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 C0E17106564A; Fri, 13 Mar 2009 17:28:51 +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 897668FC29; Fri, 13 Mar 2009 17:28:51 +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 08DF546B03; Fri, 13 Mar 2009 13:28:51 -0400 (EDT) Received: from new-host-2.baldwin.cx (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.14.3/8.14.3) with ESMTP id n2DHSiIC060842; Fri, 13 Mar 2009 13:28:44 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: <49BA9801.5080505@FreeBSD.org> Date: Fri, 13 Mar 2009 13:29:37 -0400 From: John Baldwin User-Agent: Thunderbird 2.0.0.19 (Macintosh/20081209) MIME-Version: 1.0 To: Attilio Rao References: <20090312175345.Y80227@rust.salford.ac.uk> <20090312191333.GA97342@hyperion.scode.org> <49B97617.8010709@freebsd.org> <86r6124f2v.fsf@gmail.com> <3bbf2fe10903122035i20b2767cod2322c39c6f850ee@mail.gmail.com> <29C8FA04-D5B1-49B7-ACF0-4185537367B0@baldwin.cx> <3bbf2fe10903122156u650417f0s5c49b68bdf4ffa07@mail.gmail.com> In-Reply-To: <3bbf2fe10903122156u650417f0s5c49b68bdf4ffa07@mail.gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Fri, 13 Mar 2009 13:28:45 -0400 (EDT) X-Virus-Scanned: ClamAV 0.94.2/9105/Fri Mar 13 07:58:59 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 , Mark Powell , John Baldwin , "freebsd-current@freebsd.org" , Tim Kientzle , 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: Fri, 13 Mar 2009 17:28:52 -0000 Attilio Rao wrote: > 2009/3/13, John Baldwin : >> This is similar to the patch I've asked lulf@ to test except that >> it is longer and I fix a bug where zfs_lookup() can leak a vnode >> lock if the access check fails. :-) The last one I sent to lulf@ >> is at www.FreeBSD.org/~jhb/patches/zfs_ea.patch. > > I really thought zfs_lookup() was returning the lock held as a > feature assming no LOCKLEAF. Is that a bug instead? 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. -- John Baldwin