Date: Fri, 5 Apr 2013 10:50:32 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> 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 Message-ID: <201304051050.r35AoWGN047196@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304051050.r35AoWGN047196>