Re: [PATCH 2/2] module: wait when loading a module which is currently initializing.

From: Lucas De Marchi
Date: Mon Sep 17 2012 - 13:37:38 EST


On Mon, Sep 17, 2012 at 1:36 AM, Rusty Russell <rusty@xxxxxxxxxxxxxxx> wrote:
> Lucas De Marchi <lucas.demarchi@xxxxxxxxxxxxxx> writes:
>>> - if (find_module(mod->name)) {
>>> + if ((old = find_module(mod->name)) != NULL) {
>>> + if (old->state == MODULE_STATE_COMING) {
>>> + /* Wait in case it fails to load. */
>>> + mutex_unlock(&module_mutex);
>>> + err = wait_event_interruptible(module_wq,
>>> + finished_loading(mod->name));
>>> + if (err)
>>> + goto free_arch_cleanup;
>>> + goto again;
>>
>> I wonder if we should indeed retry in case the module failed to load
>> or if we should just skip straight to returning the error code. We
>> don't have the return code for the failed load, but maybe we can
>> fabricate one here.
>>
>> Thoughts?
>
> Could have different cmdline parameters, or other randomness like
> out-of-memory. I think this is safest.

makes sense. Ack.

Lucas De Marchi
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/