1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-02-04 17:15:50 +00:00

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
This commit is contained in:
Pawel Jakub Dawidek 2012-09-28 08:22:51 +00:00
parent ba670ce023
commit 5d8a6a1078
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=241022

View File

@ -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