aboutsummaryrefslogtreecommitdiff
path: root/sys/geom/geom_event.c
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2002-09-27 20:23:35 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2002-09-27 20:23:35 +0000
commited0ff8e52d09a734ecdaba225b9a629498c75c1f (patch)
treee5bc727bb37c601050943f05285cd06de4e1c0ca /sys/geom/geom_event.c
parent903e43fe665cf180c9886ebb8e5df3021934af07 (diff)
downloadsrc-ed0ff8e52d09a734ecdaba225b9a629498c75c1f.tar.gz
src-ed0ff8e52d09a734ecdaba225b9a629498c75c1f.zip
Hook into the shutdown EVENTHANDLER and stop tasting things after we
get notified to make things settle a bit faster. Sponsored by: DARPA & NAI Labs.
Notes
Notes: svn path=/head/; revision=104054
Diffstat (limited to 'sys/geom/geom_event.c')
-rw-r--r--sys/geom/geom_event.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/geom/geom_event.c b/sys/geom/geom_event.c
index ed06d1422f44..ece6e4974ac1 100644
--- a/sys/geom/geom_event.c
+++ b/sys/geom/geom_event.c
@@ -54,6 +54,7 @@
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#include <sys/eventhandler.h>
#endif
#include <sys/errno.h>
#include <sys/time.h>
@@ -65,6 +66,7 @@ static u_int g_pending_events, g_silence_events;
static void g_do_event(struct g_event *ep);
static TAILQ_HEAD(,g_provider) g_doorstep = TAILQ_HEAD_INITIALIZER(g_doorstep);
static struct mtx g_eventlock;
+static int g_shutdown;
void
g_silence(void)
@@ -287,9 +289,23 @@ g_post_event(enum g_events ev, struct g_class *mp, struct g_geom *gp, struct g_p
wakeup(&g_wait_event);
}
+#ifdef _KERNEL
+static void
+geom_shutdown(void *foo __unused)
+{
+
+ g_shutdown = 1;
+}
+#endif
+
void
g_event_init()
{
+#ifdef _KERNEL
+
+ EVENTHANDLER_REGISTER(shutdown_pre_sync, geom_shutdown, NULL,
+ SHUTDOWN_PRI_FIRST);
+#endif
mtx_init(&g_eventlock, "GEOM orphanage", NULL, MTX_DEF);
}