From owner-svn-src-all@FreeBSD.ORG Fri Apr 5 10:50:32 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B3B63227; Fri, 5 Apr 2013 10:50:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A60B8EA7; Fri, 5 Apr 2013 10:50:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r35AoWoJ047197; Fri, 5 Apr 2013 10:50:32 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r35AoWGN047196; Fri, 5 Apr 2013 10:50:32 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201304051050.r35AoWGN047196@svn.freebsd.org> From: Alexander Motin Date: Fri, 5 Apr 2013 10:50:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r249149 - stable/9/sys/geom X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 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, 05 Apr 2013 10:50:32 -0000 Author: mav Date: Fri Apr 5 10:50:32 2013 New Revision: 249149 URL: http://svnweb.freebsd.org/changeset/base/249149 Log: MFC r240822, r241022 (by pjd): Use the topology lock to protect list of providers while withering them. It is possible that provider is destroyed while we are iterating over the list. 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. Modified: stable/9/sys/geom/geom_disk.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/geom_disk.c ============================================================================== --- stable/9/sys/geom/geom_disk.c Fri Apr 5 10:35:36 2013 (r249148) +++ stable/9/sys/geom/geom_disk.c Fri Apr 5 10:50:32 2013 (r249149) @@ -627,9 +627,14 @@ disk_gone(struct disk *dp) struct g_provider *pp; gp = dp->d_geom; - if (gp != NULL) - LIST_FOREACH(pp, &gp->provider, provider) + if (gp != NULL) { + 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); + } + } } void