> right). Or you can run a notifier on "enlivening" a module: I'd hoped
> to avoid that.
Actually, after some thought, this seems to clearly be the Right
Thing, because it solves another existing race. Consider a module
which does:
if (!register_foo(&my_foo))
goto cleanup;
if (!create_proc_entry(&my_entry))
goto cleanup_foo;
If register_foo() calls /sbin/hotplug, the module can still fail to
load and /sbin/hotplug is called for something that doesn't exist.
With the new module loader, you can also have /sbin/hotplug try to
access the module before it's gone live, which will fail to prevent
the "using before we know module won't fail init" race.
Now, if you run /sbin/hotplug out of a notifier which is fired when
the module actually goes live, this problem vanishes. It also means
we can block module unload until /sbin/hotplug is run.
The part that makes this feel like the Right Thing is that adding to
init/main.c:
/* THIS_MODULE == NULL */
notifier_call_chain(&module_notifiers, MODULE_LIVE, NULL);
means that /sbin/hotplug is called for everything which was registered
at boot. (We may not want to do this, but in general the symmetry
seems really nice).
[ Note: the logic for /sbin/hotplug applies to any similar "publicity"
function which promises that something now exists. ]
Al, thoughts?
Rusty.
-- Anyone who quotes me in their sig is an idiot. -- Rusty Russell. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sat Nov 23 2002 - 22:00:26 EST