svn commit: r249149 - stable/9/sys/geom
Alexander Motin
mav at FreeBSD.org
Fri Apr 5 10:50:32 UTC 2013
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
More information about the svn-src-stable-9
mailing list