summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-09-27 20:23:35 +0000
committerphk <phk@FreeBSD.org>2002-09-27 20:23:35 +0000
commit85fb4b059081dcaa7eec3259fff969374b3fe678 (patch)
treee5bc727bb37c601050943f05285cd06de4e1c0ca /sys
parent582654c68700a8447e4081ffee39cf5f79a8f672 (diff)
downloadFreeBSD-src-85fb4b059081dcaa7eec3259fff969374b3fe678.zip
FreeBSD-src-85fb4b059081dcaa7eec3259fff969374b3fe678.tar.gz
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.
Diffstat (limited to 'sys')
-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 ed06d14..ece6e49 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);
}
OpenPOWER on IntegriCloud