diff options
author | John Baldwin <jhb@FreeBSD.org> | 2006-06-26 18:34:45 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2006-06-26 18:34:45 +0000 |
commit | c94ce032df9e80da5c7896a3a3c9233ac76c2eab (patch) | |
tree | 6956b818699ae90a13394be5467f52d58a43aea9 | |
parent | 322fb40cbfa5d59c812f6ef469013afa7191b069 (diff) |
Notes
-rw-r--r-- | sys/kern/kern_module.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/kern/kern_module.c b/sys/kern/kern_module.c index 97317172218e..fc6a3d3a131b 100644 --- a/sys/kern/kern_module.c +++ b/sys/kern/kern_module.c @@ -99,10 +99,12 @@ module_shutdown(void *arg1, int arg2) if (arg2 & RB_NOSYNC) return; + mtx_lock(&Giant); MOD_SLOCK; TAILQ_FOREACH(mod, &modules, link) MOD_EVENT(mod, MOD_SHUTDOWN); MOD_SUNLOCK; + mtx_unlock(&Giant); } void @@ -112,6 +114,7 @@ module_register_init(const void *arg) int error; module_t mod; + mtx_lock(&Giant); MOD_SLOCK; mod = module_lookupbyname(data->name); if (mod == NULL) @@ -128,6 +131,7 @@ module_register_init(const void *arg) " %d\n", data->name, (void *)data->evhand, data->priv, error); } + mtx_unlock(&Giant); } int @@ -232,12 +236,14 @@ module_unload(module_t mod, int flags) { int error; + mtx_lock(&Giant); error = MOD_EVENT(mod, MOD_QUIESCE); if (error == EOPNOTSUPP || error == EINVAL) error = 0; - if (flags == LINKER_UNLOAD_NORMAL && error != 0) - return (error); - return (MOD_EVENT(mod, MOD_UNLOAD)); + if (error == 0 || flags == LINKER_UNLOAD_FORCE) + error = MOD_EVENT(mod, MOD_UNLOAD); + mtx_unlock(&Giant); + return (error); } int |