diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-03-10 14:43:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-03-10 21:01:19 -0400 |
commit | 6c5db22d280302c33dafb309c25bf2841fb99c37 (patch) | |
tree | 0d3711b8a32646f52eca5015447256a30bc96a88 /kernel/module.c | |
parent | 2668db9111bb1a6ab5a54f41f703179f35c7d098 (diff) |
modules: fix module waiting for dependent modules' init
Commit c9a3ba55 (module: wait for dependent modules doing init.) didn't quite
work because the waiter holds the module lock, meaning that the state of the
module it's waiting for cannot change.
Fortunately, it's fairly simple to update the state outside the lock and do
the wakeup.
Thanks to Jan Glauber for tracking this down and testing (qdio and qeth).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Jan Glauber <jang@linux.vnet.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/module.c b/kernel/module.c index be4807fb90e4..68d05d2f4d8a 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -2179,9 +2179,11 @@ sys_init_module(void __user *umod, | |||
2179 | return ret; | 2179 | return ret; |
2180 | } | 2180 | } |
2181 | 2181 | ||
2182 | /* Now it's a first class citizen! */ | 2182 | /* Now it's a first class citizen! Wake up anyone waiting for it. */ |
2183 | mutex_lock(&module_mutex); | ||
2184 | mod->state = MODULE_STATE_LIVE; | 2183 | mod->state = MODULE_STATE_LIVE; |
2184 | wake_up(&module_wq); | ||
2185 | |||
2186 | mutex_lock(&module_mutex); | ||
2185 | /* Drop initial reference. */ | 2187 | /* Drop initial reference. */ |
2186 | module_put(mod); | 2188 | module_put(mod); |
2187 | unwind_remove_table(mod->unwind_info, 1); | 2189 | unwind_remove_table(mod->unwind_info, 1); |
@@ -2190,7 +2192,6 @@ sys_init_module(void __user *umod, | |||
2190 | mod->init_size = 0; | 2192 | mod->init_size = 0; |
2191 | mod->init_text_size = 0; | 2193 | mod->init_text_size = 0; |
2192 | mutex_unlock(&module_mutex); | 2194 | mutex_unlock(&module_mutex); |
2193 | wake_up(&module_wq); | ||
2194 | 2195 | ||
2195 | return 0; | 2196 | return 0; |
2196 | } | 2197 | } |