From: Oleg Nesterov <oleg@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: apw@canonical.com, arjan@linux.intel.com, fhrbata@redhat.com,
john.johansen@canonical.com, penguin-kernel@I-love.SAKURA.ne.jp,
rientjes@google.com, rusty@rustcorp.com.au, tj@kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 5/6] kmod: introduce call_modprobe() helper
Date: Tue, 14 Feb 2012 17:48:57 +0100 [thread overview]
Message-ID: <20120214164857.GE21185@redhat.com> (raw)
In-Reply-To: <20120214164709.GA21178@redhat.com>
No functional changes. Move the call_usermodehelper code from
__request_module() into the new simple helper, call_modprobe().
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/kmod.c | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/kernel/kmod.c b/kernel/kmod.c
index 685b246..56a29e8 100644
--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -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
@@ -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;
@@ -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;
--
1.5.5.1
next prev parent reply other threads:[~2012-02-14 16:55 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-14 16:47 [PATCH 0/6] make request_module() killable Oleg Nesterov
2012-02-14 16:47 ` [PATCH 1/6] usermodehelper: introduce umh_complete(sub_info) Oleg Nesterov
2012-02-14 16:48 ` [PATCH 2/6] usermodehelper: implement UMH_KILLABLE Oleg Nesterov
2012-02-14 16:48 ` [PATCH 3/6] usermodehelper: kill umh_wait, renumber UMH_* constants Oleg Nesterov
2012-02-15 1:09 ` Rusty Russell
2012-02-15 18:12 ` Oleg Nesterov
2012-02-14 16:48 ` [PATCH 4/6] usermodehelper: ____call_usermodehelper() doesn't need do_exit() Oleg Nesterov
2012-02-14 16:48 ` Oleg Nesterov [this message]
2012-02-14 16:49 ` [PATCH 6/6] kmod: make __request_module() killable Oleg Nesterov
2012-02-15 20:30 ` Andrew Morton
2012-02-16 15:04 ` Oleg Nesterov
2012-02-16 17:26 ` [PATCH 0/4] make vfork() killable Oleg Nesterov
2012-02-16 17:26 ` [PATCH 1/4] introduce complete_vfork_done() Oleg Nesterov
2012-02-17 0:35 ` Andrew Morton
2012-02-17 14:37 ` Oleg Nesterov
2012-02-16 17:27 ` [PATCH 2/4] vfork: make it killable Oleg Nesterov
2012-02-17 0:39 ` Andrew Morton
2012-02-17 14:44 ` Oleg Nesterov
2012-02-16 17:27 ` [PATCH 3/4] coredump_wait: don't call complete_vfork_done() Oleg Nesterov
2012-02-16 17:27 ` [PATCH 4/4] kill PF_STARTING Oleg Nesterov
2012-02-17 0:26 ` [PATCH 0/4] make vfork() killable Andrew Morton
2012-02-17 2:45 ` Stephen Rothwell
2012-02-17 14:46 ` Oleg Nesterov
[not found] ` <20120216173233.GF30393@redhat.com>
[not found] ` <201202172211.CGH81726.OStOJFLFHQVMFO@I-love.SAKURA.ne.jp>
[not found] ` <20120217150726.GD22440@redhat.com>
2012-02-17 18:00 ` [PATCH 0/1] hung_task: fix the broken rcu_lock_break() logic Oleg Nesterov
2012-02-17 18:00 ` [PATCH 1/1] " Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120214164857.GE21185@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=arjan@linux.intel.com \
--cc=fhrbata@redhat.com \
--cc=john.johansen@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=rientjes@google.com \
--cc=rusty@rustcorp.com.au \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox