From: Stanislav Kinsburskiy <skinsbur...@virtuozzo.com>

This will allow to use a different one for containers.

Signed-off-by: Stanislav Kinsburskiy <skinsbur...@virtuozzo.com>

(cherry-picked from vz8 commit 041bcd5475d5 ("ve/umh: make queue
function one of the subprocess_info parameters"))

Signed-off-by: Nikita Yushchenko <nikita.yushche...@virtuozzo.com>
---
 include/linux/umh.h |  1 +
 kernel/umh.c        | 24 ++++++++++++++++++++++--
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/include/linux/umh.h b/include/linux/umh.h
index 244aff638220..d91be2030375 100644
--- a/include/linux/umh.h
+++ b/include/linux/umh.h
@@ -26,6 +26,7 @@ struct subprocess_info {
        int retval;
        int (*init)(struct subprocess_info *info, struct cred *new);
        void (*cleanup)(struct subprocess_info *info);
+       void (*queue)(struct subprocess_info *info);
        void *data;
 } __randomize_layout;
 
diff --git a/kernel/umh.c b/kernel/umh.c
index 04e60474f1c8..8654aa356b26 100644
--- a/kernel/umh.c
+++ b/kernel/umh.c
@@ -332,6 +332,11 @@ static void helper_unlock(void)
                wake_up(&running_helpers_waitq);
 }
 
+static void call_usermodehelper_queue(struct subprocess_info *info)
+{
+       queue_work(system_unbound_wq, &info->work);
+}
+
 /**
  * call_usermodehelper_setup - prepare to call a usermode helper
  * @path: path to usermode executable
@@ -355,10 +360,12 @@ static void helper_unlock(void)
  * Function must be runnable in either a process context or the
  * context in which call_usermodehelper_exec is called.
  */
-struct subprocess_info *call_usermodehelper_setup(const char *path, char 
**argv,
+static struct subprocess_info *__call_usermodehelper_setup(const char *path,
+               char **argv,
                char **envp, gfp_t gfp_mask,
                int (*init)(struct subprocess_info *info, struct cred *new),
                void (*cleanup)(struct subprocess_info *info),
+               void (*queue)(struct subprocess_info *info),
                void *data)
 {
        struct subprocess_info *sub_info;
@@ -378,10 +385,23 @@ struct subprocess_info *call_usermodehelper_setup(const 
char *path, char **argv,
 
        sub_info->cleanup = cleanup;
        sub_info->init = init;
+       sub_info->queue = queue;
        sub_info->data = data;
   out:
        return sub_info;
 }
+
+struct subprocess_info *call_usermodehelper_setup(const char *path, char 
**argv,
+               char **envp, gfp_t gfp_mask,
+               int (*init)(struct subprocess_info *info, struct cred *new),
+               void (*cleanup)(struct subprocess_info *info),
+               void *data)
+{
+       return __call_usermodehelper_setup(path, argv, envp, gfp_mask,
+                                          init, cleanup,
+                                          call_usermodehelper_queue,
+                                          data);
+}
 EXPORT_SYMBOL(call_usermodehelper_setup);
 
 /**
@@ -436,7 +456,7 @@ int call_usermodehelper_exec(struct subprocess_info 
*sub_info, int wait)
        sub_info->complete = (wait == UMH_NO_WAIT) ? NULL : &done;
        sub_info->wait = wait;
 
-       queue_work(system_unbound_wq, &sub_info->work);
+       sub_info->queue(sub_info);
        if (wait == UMH_NO_WAIT)        /* task has freed sub_info */
                goto unlock;
 
-- 
2.30.2

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to