diff options
author | phk <phk@FreeBSD.org> | 2003-05-12 20:15:28 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-05-12 20:15:28 +0000 |
commit | 489ad0717953ca505333e51253297407738a7f04 (patch) | |
tree | f3fff1a156910e30cdb6b2315e1f956d9d9bea52 /sys/geom/geom_disk.c | |
parent | 7547478850f17e32fc0856587c660a8b041cc972 (diff) | |
download | FreeBSD-src-489ad0717953ca505333e51253297407738a7f04.zip FreeBSD-src-489ad0717953ca505333e51253297407738a7f04.tar.gz |
When a disk disappears, destroy the class from the event thread
to avoid race condtion.
Approved by: re/rwatson
Diffstat (limited to 'sys/geom/geom_disk.c')
-rw-r--r-- | sys/geom/geom_disk.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index f36ec05..73c7221 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -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 |