module: remove over-zealous check in __module_get()
authorRusty Russell <[email protected]>
Sat, 7 Feb 2009 07:45:56 +0000 (18:15 +1030)
committerLinus Torvalds <[email protected]>
Sat, 7 Feb 2009 16:33:01 +0000 (08:33 -0800)
Impact: fix spurious BUG_ON() triggered under load

module_refcount() isn't reliable outside stop_machine(), as demonstrated
by Karsten Keil <[email protected]>, networking can trigger it under load
(an inc on one cpu and dec on another while module_refcount() is tallying
 can give false results, for example).

Almost noone should be using __module_get, but that's another issue.

Cc: Karsten Keil <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
include/linux/module.h

index f3b8329eb5b877d7233ab66d566dd280fc78536c..145a75528cc1868c275bbbcfacb97ab0124eab46 100644 (file)
@@ -407,7 +407,6 @@ static inline local_t *__module_ref_addr(struct module *mod, int cpu)
 static inline void __module_get(struct module *module)
 {
        if (module) {
-               BUG_ON(module_refcount(module) == 0);
                local_inc(__module_ref_addr(module, get_cpu()));
                put_cpu();
        }