aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2012-03-23 18:02:47 -0400
committerLuis Henriques <luis.henriques@canonical.com>2012-04-05 11:17:14 -0400
commitde7db9c247875ac10d4d27da70c668109e0108cf (patch)
treea6966354e2492047f3629f97a4c2e654a725c870 /include/linux
parent20cf2e1d3b45a810ec5e52f6c2684a413dfc9394 (diff)
usermodehelper: implement UMH_KILLABLE
BugLink: http://bugs.launchpad.net/bugs/963685 Implement UMH_KILLABLE, should be used along with UMH_WAIT_EXEC/PROC. The caller must ensure that subprocess_info->path/etc can not go away until call_usermodehelper_freeinfo(). call_usermodehelper_exec(UMH_KILLABLE) does wait_for_completion_killable. If it fails, it uses xchg(&sub_info->complete, NULL) to serialize with umh_complete() which does the same xhcg() to access sub_info->complete. If call_usermodehelper_exec wins, it can safely return. umh_complete() should get NULL and call call_usermodehelper_freeinfo(). Otherwise we know that umh_complete() was already called, in this case call_usermodehelper_exec() falls back to wait_for_completion() which should succeed "very soon". Note: UMH_NO_WAIT == -1 but it obviously should not be used with UMH_KILLABLE. We delay the neccessary cleanup to simplify the back porting. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Tejun Heo <tj@kernel.org> Cc: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> (cherry picked from commit d0bd587a80960d7ba7e0c8396e154028c9045c54) Signed-off-by: Tim Gardner <tim.gardner@canonical.com> Acked-by: Stefan Bader <stefan.bader@canonical.com> Acked-by: Andy Whitcroft <andy.whitcroft@canonical.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/kmod.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/kmod.h b/include/linux/kmod.h
index 8a02da82aa9..846f5695230 100644
--- a/include/linux/kmod.h
+++ b/include/linux/kmod.h
@@ -54,6 +54,8 @@ enum umh_wait {
54 UMH_WAIT_PROC = 1, /* wait for the process to complete */ 54 UMH_WAIT_PROC = 1, /* wait for the process to complete */
55}; 55};
56 56
57#define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */
58
57struct subprocess_info { 59struct subprocess_info {
58 struct work_struct work; 60 struct work_struct work;
59 struct completion *complete; 61 struct completion *complete;