Module Name: src
Committed By: pgoyette
Date: Wed Sep 19 06:26:13 UTC 2018
Modified Files:
src/sys/sys [pgoyette-compat]: module_hook.h
Log Message:
Ooops - we need to grab the mutex before we can drain the localcount!
To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/sys/module_hook.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/sys/module_hook.h
diff -u src/sys/sys/module_hook.h:1.1.2.1 src/sys/sys/module_hook.h:1.1.2.2
--- src/sys/sys/module_hook.h:1.1.2.1 Tue Sep 18 21:38:08 2018
+++ src/sys/sys/module_hook.h Wed Sep 19 06:26:13 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: module_hook.h,v 1.1.2.1 2018/09/18 21:38:08 pgoyette Exp $ */
+/* $NetBSD: module_hook.h,v 1.1.2.2 2018/09/19 06:26:13 pgoyette Exp $ */
/*-
* Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -116,6 +116,9 @@ static void (hook ## _unset)(void) \
KASSERT(hook.hooked); \
KASSERT(hook.f); \
\
+ /* Grab the mutex */ \
+ mutex_enter(&hook.mtx); \
+ \
/* Prevent new localcount_acquire calls. */ \
hook.hooked = false; \
\
@@ -125,6 +128,8 @@ static void (hook ## _unset)(void) \
/* Wait for existing localcount references to drain. */\
localcount_drain(&hook.lc, &hook.cv, &hook.mtx); \
\
+ /* Release the mutex and clean up all resources */ \
+ mutex_exit(&hook.mtx); \
localcount_fini(&hook.lc); \
cv_destroy(&hook.cv); \
mutex_destroy(&hook.mtx); \