No sysfs directory for openvswitch module when built-in

From: Cong Wang
Date: Tue Jan 29 2013 - 09:15:27 EST


Hello, Rusty, Jesse,

I met an interesting problem when I compile openvswitch module as a
built-in (actually I compile ALL kernel modules as built-in), there is
no /sys/module/openvswitch/ directory created by the kernel in this
case.

What's worse, the user-space init script thinks openvswitch module is
not loaded by checking the exist of this directory, therefore refuses
to start.

After digging a little deeper, I found the cause of this problem is
actually that the core kernel doesn't create directory for any kernel
module without a module version or any module parameters when
built-in. Openvswitch is exactly such a module!!

I believe there is nothing wrong either in the user-space init script,
or in the openvswitch kernel module. So, the question why core kernel
doesn't create module directory for such modules?

>From the code:

static int __init param_sysfs_init(void)
{
module_kset = kset_create_and_add("module", &module_uevent_ops, NULL);
if (!module_kset) {
printk(KERN_WARNING "%s (%d): error creating kset\n",
__FILE__, __LINE__);
return -ENOMEM;
}
module_sysfs_initialized = 1;

version_sysfs_builtin();
param_sysfs_builtin();

return 0;
}

it seems there is no way to get the name of the kernel module in such
case, the above searches module name either in parameter or in version
information. But I may miss something here...

We can certainly workaround this issue by providing a (dummy) version
in openvswitch module, but the more important question is can't we fix
this in core kernel? It is perfectly valid to provide a kernel module
without either a module version or any module parameter.

What do you think?

Thanks!
--
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/