What the OS does ?
In my Debian (but i would bet that your CentOS just do the same), the module loading part of initialization is done by /etc/init.d/kmod
.
Below is an extract of this script:
files=$(modules_files)
if [ "$files" ] ; then
grep -h '^[^#]' $files |
while read module args; do
[ "$module" ] || continue
load_module "$module" "$args"
done
fi
Where:
modules_files
is a shell function that parses various file and directories (including /etc/modules-load.d
) and built a list of modules to be loaded.
load_module
is a shell function that do the modprobe
work + some logging if verbose flag is set.
So i would say that yes, modules are loaded sequentially and if one blocks, then it will block the other ones....
but ...
What kernel does ?
When reading the source code of linux/modules.c we can see that:
The syscall is probably implemented by the function load_module()
. We can see that it performs a lot of stuff (initialization, memory allocation, sanity checks, signature checks, etc..) and it returns with return do_init_module(mod);
(line 3927
The do_init_module()
function do at line 3574 the following operation and, if everything went ok, return 0.
if (mod->init != NULL)
ret = do_one_initcall(mod->init);
if (ret < 0) {
goto fail_free_freeinit;
}
My conclusion is the syscall will return only when:
1. The module has been loaded in memory.
2. Its init() function has ran successfully.
So if your call to wait_for_random_bytes()
is part of the init function of your module, then yes, it may block others modules loading.