Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 295272
b: refs/heads/master
c: 3e63a93
h: refs/heads/master
v: v3
  • Loading branch information
Oleg Nesterov authored and Linus Torvalds committed Mar 23, 2012
1 parent 38f547a commit aabde9c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5b9bd473e3b8a8c6c4ae99be475e6e9b27568555
refs/heads/master: 3e63a93b987685f02421e18b2aa452d20553a88b
24 changes: 16 additions & 8 deletions trunk/kernel/kmod.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,21 @@ static DECLARE_RWSEM(umhelper_sem);
*/
char modprobe_path[KMOD_PATH_LEN] = "/sbin/modprobe";

static int call_modprobe(char *module_name, int wait)
{
static char *envp[] = {
"HOME=/",
"TERM=linux",
"PATH=/sbin:/usr/sbin:/bin:/usr/bin",
NULL
};

char *argv[] = { modprobe_path, "-q", "--", module_name, NULL };

return call_usermodehelper_fns(modprobe_path, argv, envp,
wait, NULL, NULL, NULL);
}

/**
* __request_module - try to load a kernel module
* @wait: wait (or not) for the operation to complete
Expand All @@ -81,11 +96,6 @@ int __request_module(bool wait, const char *fmt, ...)
char module_name[MODULE_NAME_LEN];
unsigned int max_modprobes;
int ret;
char *argv[] = { modprobe_path, "-q", "--", module_name, NULL };
static char *envp[] = { "HOME=/",
"TERM=linux",
"PATH=/sbin:/usr/sbin:/bin:/usr/bin",
NULL };
static atomic_t kmod_concurrent = ATOMIC_INIT(0);
#define MAX_KMOD_CONCURRENT 50 /* Completely arbitrary value - KAO */
static int kmod_loop_msg;
Expand Down Expand Up @@ -128,9 +138,7 @@ int __request_module(bool wait, const char *fmt, ...)

trace_module_request(module_name, wait, _RET_IP_);

ret = call_usermodehelper_fns(modprobe_path, argv, envp,
wait ? UMH_WAIT_PROC : UMH_WAIT_EXEC,
NULL, NULL, NULL);
ret = call_modprobe(module_name, wait ? UMH_WAIT_PROC : UMH_WAIT_EXEC);

atomic_dec(&kmod_concurrent);
return ret;
Expand Down

0 comments on commit aabde9c

Please sign in to comment.