internal/providers: Only load kernel modules when actually necessary#2164
internal/providers: Only load kernel modules when actually necessary#2164prestist merged 1 commit intocoreos:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a sensible optimization to avoid loading kernel modules with modprobe if they are already available (e.g., built-in). The approach of checking for the existence of a device file in /sys is correct. However, the error handling for the os.Stat call is incomplete in all the modified files. It only handles the os.IsNotExist case and silently ignores other potential errors, which could lead to unexpected behavior. My review includes suggestions to make the error handling more robust.
If the modules are built-in, attempting to load them with modprobe will cause a fatal error. Having them built-in makes kernel debugging easier. I didn't touch the vmur (zvm) module as I'm not familiar with that. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
prestist
left a comment
There was a problem hiding this comment.
Makes sense to check before loading, I was going to push for unit tests, but after fumbling through it locally its not very helpful.
We should probably document a link for each path in a comment above? so that if for what ever reason it changes we can quickly find docs on it wdyt?
Otherwise these changes make sense and we can land them.
Sorry for the wait. I've had a good look, but I can't find these documented anywhere. You can't even easily tell from looking at the kernel code. I just determined them by loading the modules and having a look. Like I said, it's not the end of the world if they do change. |
If the modules are built-in, attempting to load them with modprobe will cause a fatal error. Having them built-in makes kernel debugging easier.
I didn't touch the vmur (zvm) module as I'm not familiar with that.