Let's use get_exec_env() everywhere instead of having part of places
using it and part of places using current->task_ve.

Note: In ve_start_container we technically have tsk->task_ve, but tsk is
always equal to current, so let's simplify it.

https://virtuozzo.atlassian.net/browse/VSTOR-118289
Signed-off-by: Pavel Tikhomirov <[email protected]>

Feature: ve: ve generic structures
---
 kernel/exit.c  | 3 ++-
 kernel/ve/ve.c | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index f5b40a392988e..922c0e3f62363 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -71,6 +71,7 @@
 #include <linux/sysfs.h>
 #include <linux/user_events.h>
 #include <linux/uaccess.h>
+#include <linux/ve.h>
 
 #include <uapi/linux/wait.h>
 
@@ -557,7 +558,7 @@ static void exit_mm(void)
 
 #ifdef CONFIG_VE
 #define K(x) ((x) << (PAGE_SHIFT-10))
-       if (!ve_is_super(current->task_ve) &&
+       if (!ve_is_super(get_exec_env()) &&
            test_tsk_thread_flag(current, TIF_MEMDIE))
                ve_printk(VE_LOG, KERN_ERR "OOM killed process %d (%s) "
                          "total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB\n",
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index 1bde9c27f8683..ba0d64dea7b2e 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -707,7 +707,7 @@ static int ve_start_container(struct ve_struct *ve)
        if (ve->state != VE_STATE_STARTING || ve_nsproxy)
                return -EBUSY;
 
-       if (tsk->task_ve != ve || !is_child_reaper(task_pid(tsk)))
+       if (get_exec_env() != ve || !is_child_reaper(task_pid(tsk)))
                return -ECHILD;
 
        /*
@@ -790,7 +790,7 @@ static int ve_start_container(struct ve_struct *ve)
 
 void ve_stop_ns(struct pid_namespace *pid_ns)
 {
-       struct ve_struct *ve = current->task_ve;
+       struct ve_struct *ve = get_exec_env();
        struct nsproxy *ve_nsproxy;
 
        down_write(&ve->op_sem);
@@ -842,7 +842,7 @@ void ve_stop_ns(struct pid_namespace *pid_ns)
 
 void ve_exit_ns(struct pid_namespace *pid_ns)
 {
-       struct ve_struct *ve = current->task_ve;
+       struct ve_struct *ve = get_exec_env();
        struct nsproxy *ve_nsproxy;
 
        /*
-- 
2.51.1

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to