In message <Pine.LNX.4.44.0209121043160.28515-100000@serv> you write:> Sigh, please let's analyze the complete problem first, before making any> more kludges.> Every (loaded) module is at least registered with two hooks in the kernel> - the module structure and a driver structure (e.g. file_system_type for> fs). During unloading we have to remove these hooks safely again.> A module basically goes through these stages during its lifetime:> 1. module load> 2. module init> 3. module exit> 4. module unload> The problem now is stage 3, as it's not allowed to fail. This means beforeNope, that's one of the two problems. Read my previous post: theother is partial initialization.

Your patch is two-stage delete, with the additional of a usecountfunction. So you have to move the usecount from the module to eachobject it registers: great for filesystems, but I don't think it buysyou anything (since they were easy anyway).

Moreover, I don't see where your patch prevented someone increasingthe module count during try_unregister_module(), so that check ispointless (do it in userspace unless they specify rmmod -f).

Alexey said we needed two-stage module delete back in 1999, so this isnot a new idea...