When a disk disappears, destroy the class from the event thread

to avoid race condtion.

Approved by:	re/rwatson
This commit is contained in:
phk 2003-05-12 20:15:28 +00:00
parent 7547478850
commit 489ad07179

View File

@ -345,6 +345,15 @@ disk_create(int unit, struct disk *dp, int flags, void *unused __unused, void *
* XXX: disk_create() and disk_destroy() is currently undefined (but generally
* XXX: undesirable) so any solution seems to involve an intrusive decision.
*/
static void
disk_destroy_event(void *ptr, int flag)
{
g_topology_assert();
g_wither_geom(ptr, ENXIO);
}
void
disk_destroy(struct disk *dp)
{
@ -356,7 +365,7 @@ disk_destroy(struct disk *dp)
return;
gp->softc = NULL;
devstat_remove_entry(dp->d_devstat);
g_wither_geom(gp, ENXIO);
g_post_event(disk_destroy_event, gp, M_WAITOK, NULL, NULL);
}
static void