From owner-freebsd-fs@FreeBSD.ORG Mon Jun 13 20:21:01 2011 Return-Path: Delivered-To: fs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 125D31065670; Mon, 13 Jun 2011 20:21:01 +0000 (UTC) (envelope-from gibbs@FreeBSD.org) Received: from aslan.scsiguy.com (mail.scsiguy.com [70.89.174.89]) by mx1.freebsd.org (Postfix) with ESMTP id D7F758FC12; Mon, 13 Jun 2011 20:21:00 +0000 (UTC) Received: from Justins-MacBook-Pro.local (207-225-98-3.dia.static.qwest.net [207.225.98.3]) (authenticated bits=0) by aslan.scsiguy.com (8.14.4/8.14.4) with ESMTP id p5DKMLPE008685 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 13 Jun 2011 14:22:21 -0600 (MDT) (envelope-from gibbs@FreeBSD.org) Message-ID: <4DF67126.50404@FreeBSD.org> Date: Mon, 13 Jun 2011 14:20:54 -0600 From: "Justin T. Gibbs" Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: Pawel Jakub Dawidek References: <4DF25544.3020301@FreeBSD.org> <20110613201543.GA1733@garage.freebsd.pl> In-Reply-To: <20110613201543.GA1733@garage.freebsd.pl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (aslan.scsiguy.com [70.89.174.89]); Mon, 13 Jun 2011 14:22:21 -0600 (MDT) Cc: fs@FreeBSD.org Subject: Re: Drop of spa_namespace lock in vdev_geom.c X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: gibbs@FreeBSD.org List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jun 2011 20:21:01 -0000 On 6/13/11 2:15 PM, Pawel Jakub Dawidek wrote: > On Fri, Jun 10, 2011 at 11:32:52AM -0600, Justin T. Gibbs wrote: >> Dropping and reacquiring the spa_namespace lock in vdev_geom_open() >> creates a lock order reversal with the spa_config locks. As the >> spa_config locks are not standard mutexes, witness will not warn >> about this issue. I only noticed this problem when debugging a ZFS >> deadlock. The deadlock can be triggered anytime that there are >> multiple insert/remove processes going on (e.g. vdev orphan processing >> while a fault management daemon is onlining a replacement device for >> some other vdev). >> >> I haven't noticed any issues with just holding the namespace lock >> for the duration of the open. Does anyone know why this lock drop >> was added in v28? > I did that as part of @182208 to fix another LOR. Full commit log: > > Change 182208 on 2010/08/10 by pjd@pjd_zoo ... > To make it work I had to fix LOR between the zfsdev_state_lock, the > GEOM topology lock and the spa_namespace_lock. They are now always > obtained in the following order: > 1. zfsdev_state_lock > 2. g_topology_lock > 3. spa_namespace_lock > Also, we can't use taskqueue to scan for VDEVs as this introduces > deadlock (because there is no way to honour the order above). I'll review these code paths later today and see if I can find an alternate way to resolve the issue. -- Justin