summaryrefslogtreecommitdiffstats
path: root/sys/geom/vinum/geom_vinum_events.c
diff options
context:
space:
mode:
authorjh <jh@FreeBSD.org>2010-05-10 19:12:23 +0000
committerjh <jh@FreeBSD.org>2010-05-10 19:12:23 +0000
commite34ccbdd5795e4eeb93ec23a598ccb9342d9612a (patch)
treed0399c83b28e2e031a8d8a40aece04c54e605b56 /sys/geom/vinum/geom_vinum_events.c
parenta27d539c9ac7b17319630c5b530429562f22145c (diff)
downloadFreeBSD-src-e34ccbdd5795e4eeb93ec23a598ccb9342d9612a.zip
FreeBSD-src-e34ccbdd5795e4eeb93ec23a598ccb9342d9612a.tar.gz
- Don't return EAGAIN from gv_unload(). It was used to work around the
deadlock fixed in r207671. - Wait for worker process to exit at class unload. The worker process was not guaranteed to exit before the linker unloaded the module. - Use 0 as the worker process exit status instead of ENXIO and style the NOTREACHED comment. Reviewed by: lulf X-MFC after: r207671
Diffstat (limited to 'sys/geom/vinum/geom_vinum_events.c')
-rw-r--r--sys/geom/vinum/geom_vinum_events.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/geom/vinum/geom_vinum_events.c b/sys/geom/vinum/geom_vinum_events.c
index 02c14ce..fcd45f1 100644
--- a/sys/geom/vinum/geom_vinum_events.c
+++ b/sys/geom/vinum/geom_vinum_events.c
@@ -58,6 +58,20 @@ gv_post_event(struct gv_softc *sc, int event, void *arg1, void *arg2,
mtx_unlock(&sc->equeue_mtx);
}
+void
+gv_worker_exit(struct gv_softc *sc)
+{
+ struct gv_event *ev;
+
+ ev = g_malloc(sizeof(*ev), M_WAITOK | M_ZERO);
+ ev->type = GV_EVENT_THREAD_EXIT;
+
+ mtx_lock(&sc->equeue_mtx);
+ TAILQ_INSERT_TAIL(&sc->equeue, ev, events);
+ wakeup(sc);
+ msleep(sc->worker, &sc->equeue_mtx, PDROP, "gv_wor", 0);
+}
+
struct gv_event *
gv_get_event(struct gv_softc *sc)
{
OpenPOWER on IntegriCloud