Re: [PATCH] libkmod-module: Remove directory existence check for KMOD_MODULE_BUILTIN

Lucas De Marchi
2015-02-19T10:31:04Z

On Thu, Feb 19, 2015 at 3:49 AM, Harish Jenny Kandiga Nagaraj
<harish_kandiga@mentor.com> wrote:
>> Harrish, in your patch if you just change the "return
>> KMOD_MODULE_BUILTIN;" to "return KMOD_MODULE_COMING;" does it work?
>
> Yes. Returning KMOD_MODULE_COMING instead of KMOD_MODULE_BUILTIN works. The built-in modules are handled by looking at the modules.builtin index file. Is there any chance of returning KMOD_MODULE_COMING for builti-in modules? If it does not have any impact, then the fix should be fine.

well... you're not returning KMOD_MODULE_COMING for a builtin module.
Having the directory /sys/module/<name> and not the initstate could be
either that the module is builtin or that there's a race while loading
the module and it's in the coming state. However since we use the
index to decide if this module is builtin in the beginning of this
function, here it can only be the second case.

However... mod->builtin in the beginning of this function is only set
if the module is created by a lookup rather than from name or from
path.... maybe here we need to actually fallback to the index rather
than the cached value, otherwise this test would fail (considering
"vt" is builtin):

kmod_module_new_from_name(ctx, "vt", &mod);
kmod_module_get_initstate(mod, &state);

> Do I need to send a separate patch ?

I was hoping it would be a oneliner, but it isn't. If you are going to
send a patch, please add the necessary checks for the builtin index.
Otherwise I can take a look on this until the end of this week.

--
Lucas De Marchi