From owner-freebsd-fs@FreeBSD.ORG Sun Oct 7 15:32:12 2012 Return-Path: Delivered-To: fs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E45B2106566C; Sun, 7 Oct 2012 15:32:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id CC9908FC16; Sun, 7 Oct 2012 15:32:11 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id SAA15154; Sun, 07 Oct 2012 18:32:05 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1TKspp-0008Hl-Jh; Sun, 07 Oct 2012 18:32:05 +0300 Message-ID: <5071A071.1020800@FreeBSD.org> Date: Sun, 07 Oct 2012 18:32:01 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:15.0) Gecko/20120913 Thunderbird/15.0.1 MIME-Version: 1.0 To: "Justin T. Gibbs" , Pawel Jakub Dawidek , Konstantin Belousov References: <76CBA055-021F-458D-8978-E9A973D9B783@scsiguy.com> <506EB43B.8050204@FreeBSD.org> In-Reply-To: <506EB43B.8050204@FreeBSD.org> X-Enigmail-Version: 1.4.3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: fs@FreeBSD.org Subject: Re: ZFS: Deadlock during vnode recycling X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2012 15:32:13 -0000 In fact here is a real patch that I would like to propose: http://people.freebsd.org/~avg/zfs-getnewvnode_reserve.diff The patch incorporates the kib's patch for extending VFS API that helps to avoid entering the vnode inactive/reclaim path from getnewvnode. The patch should fix the problem reported in this thread and the problem from "panic: _sx_xlock_hard: recursed on non-recursive sx zfsvfs->z_hold_mtx ..." thread that runs in parallel. Reviews and testing are welcome. Here is a draft of a commit message that also provides some additional details: zfs: overhaul zfs_freebsd_reclaim and zfs_zget... now that we do not need to fear recursion from getnewvnode into zfs_inactive and zfs_freebsd_reclaim. This removes the need for the delayed destruction of znodes via taskqueue, thus making znode/vnode state machine a bit simpler. Also, try to make zfs_zget saner with respected to doomed vnodes to avoid a deadlock when zfs_zget is called from zfs_freebsd_recycle. To do: pass locking flags parameter to zfs_zget, so that the zfs-vfs glue code doesn't have to re-lock a vnode but could ask for proper locking from the very start. The patch also drops some redundant interlock acquisitions, since both vop_inactive and vop_reclaim are called with exclusive vnode lock held. -- Andriy Gapon