From owner-svn-src-all@FreeBSD.ORG Fri Sep 28 08:22:51 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9A55106566B; Fri, 28 Sep 2012 08:22:51 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 920FF8FC15; Fri, 28 Sep 2012 08:22:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8S8Mpar003295; Fri, 28 Sep 2012 08:22:51 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8S8Mp5G003292; Fri, 28 Sep 2012 08:22:51 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201209280822.q8S8Mp5G003292@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Fri, 28 Sep 2012 08:22:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241022 - head/sys/geom X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 08:22:51 -0000 Author: pjd Date: Fri Sep 28 08:22:51 2012 New Revision: 241022 URL: http://svn.freebsd.org/changeset/base/241022 Log: Remove the topology lock from disk_gone(), it might be called with regular mutexes held and the topology lock is an sx lock. The topology lock was there to protect traversing through the list of providers of disk's geom, but it seems that disk's geom has always exactly one provider. Change the code to call g_wither_provider() for this one provider, which is safe to do without holding the topology lock and assert that there is indeed only one provider. Discussed with: ken MFC after: 1 week Modified: head/sys/geom/geom_disk.c Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Fri Sep 28 07:51:30 2012 (r241021) +++ head/sys/geom/geom_disk.c Fri Sep 28 08:22:51 2012 (r241022) @@ -635,13 +635,15 @@ disk_gone(struct disk *dp) struct g_geom *gp; struct g_provider *pp; - g_topology_lock(); gp = dp->d_geom; if (gp != NULL) { - LIST_FOREACH(pp, &gp->provider, provider) + pp = LIST_FIRST(&gp->provider); + if (pp != NULL) { + KASSERT(LIST_NEXT(pp, provider) == NULL, + ("geom %p has more than one provider", gp)); g_wither_provider(pp, ENXIO); + } } - g_topology_unlock(); } void