diff options
| author | Rusty Russell <rusty@rustcorp.com.au> | 2003-07-18 05:23:37 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.osdl.org> | 2003-07-18 05:23:37 -0700 |
| commit | f965803d21981208b5d483414e3c6b797363f37a (patch) | |
| tree | f651e6e57087cc84748ebefc40b3e6edf72e6582 /include/linux | |
| parent | dc33faea52587f59b5b295d6db04e5e5699d272a (diff) | |
[PATCH] module_put_and_exit
Author: Neil Brown
Define module_put_and_exit() and use it for nfsd/lockd
Both nfsd and lockd have threads which expect to hold a reference
to the module while the thread is running. In order for the thread
to be able to put_module() the module before exiting, the
put_module code must be call from outside the module.
This patch provides module_put_and_exit in non-modular code which a
thread-in-a-module can call. It also gets nfsd and lockd to use it
as appropriate.
Note that in lockd, we can __get_module in the thread itself as the
creator of the thread is waiting for the thread to startup.
In nfsd and for the 'reclaimer' threaded started by locked, we
__get_module first and put_module if the thread failed to start.
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/module.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/module.h b/include/linux/module.h index d12463033162..13ff244afdbf 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -277,8 +277,12 @@ struct module *module_get_kallsym(unsigned int symnum, char *type, char namebuf[128]); int is_exported(const char *name, const struct module *mod); -#ifdef CONFIG_MODULE_UNLOAD +extern void __module_put_and_exit(struct module *mod, long code) + __attribute__((noreturn)); +#define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code); + +#ifdef CONFIG_MODULE_UNLOAD unsigned int module_refcount(struct module *mod); void __symbol_put(const char *symbol); #define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x) @@ -440,6 +444,8 @@ static inline int unregister_module_notifier(struct notifier_block * nb) return 0; } +#define module_put_and_exit(code) do_exit(code) + #endif /* CONFIG_MODULES */ #ifdef MODULE |
