summaryrefslogtreecommitdiffstats
path: root/sys/geom/geom_disk.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2012-09-28 08:22:51 +0000
committerpjd <pjd@FreeBSD.org>2012-09-28 08:22:51 +0000
commit785571bd2b886e6694a7a9a08f7bdd6f1ce8ce7a (patch)
tree2d5e5641d50be7e9d56eaa3ecb82334faeb677a8 /sys/geom/geom_disk.c
parenta93e845e54aef353af783f879e3482a9e473a572 (diff)
downloadFreeBSD-src-785571bd2b886e6694a7a9a08f7bdd6f1ce8ce7a.zip
FreeBSD-src-785571bd2b886e6694a7a9a08f7bdd6f1ce8ce7a.tar.gz
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
Diffstat (limited to 'sys/geom/geom_disk.c')
-rw-r--r--sys/geom/geom_disk.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c
index d3e10cc..12ad612 100644
--- a/sys/geom/geom_disk.c
+++ b/sys/geom/geom_disk.c
@@ -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
OpenPOWER on IntegriCloud