We don't need extra STOPPED state. It makes us feel that CT could be started again from it, but it is actually not true.
Separate STOPPED state doesn't bring any value. Drop it and transition VE to DEAD state directly on the stop, instead of doing it in ve_destroy. https://virtuozzo.atlassian.net/browse/VSTOR-142405 Reviewed-by: Pavel Tikhomirov <[email protected]> Signed-off-by: Vladimir Riabchun <[email protected]> --- include/linux/ve.h | 3 +-- kernel/ve/ve.c | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/include/linux/ve.h b/include/linux/ve.h index a400d21593b2..717567775f58 100644 --- a/include/linux/ve.h +++ b/include/linux/ve.h @@ -40,8 +40,7 @@ struct vfsmount; #define VE_STATE_STARTING 0 #define VE_STATE_RUNNING 1 #define VE_STATE_STOPPING 2 -#define VE_STATE_STOPPED 3 -#define VE_STATE_DEAD 4 +#define VE_STATE_DEAD 3 #define VE_IS_RUNNING(ve) ((ve)->state == VE_STATE_RUNNING) diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c index cdfd03416b39..d3f02fe118ca 100644 --- a/kernel/ve/ve.c +++ b/kernel/ve/ve.c @@ -608,7 +608,7 @@ static int ve_start_container(struct ve_struct *ve) err_mark_ve: ve_list_del(ve); err_list: - ve_set_state(ve, VE_STATE_STOPPED); + ve_set_state(ve, VE_STATE_DEAD); ve_drop_context(ve); return err; } @@ -684,7 +684,7 @@ void ve_exit_ns(struct pid_namespace *pid_ns) ve_hook_iterate_fini(VE_SS_CHAIN, ve); ve_list_del(ve); ve_drop_context(ve); - ve_set_state(ve, VE_STATE_STOPPED); + ve_set_state(ve, VE_STATE_DEAD); up_write(&ve->op_sem); printk(KERN_INFO "CT: %s: stopped\n", ve_name(ve)); @@ -930,7 +930,6 @@ static void ve_destroy(struct cgroup_subsys_state *css) mntput(ve->devtmpfs_mnt); free_percpu(ve->sched_lat_ve.cur); kfree(ve->ve_name); - ve_set_state(ve, VE_STATE_DEAD); kmem_cache_free(ve_cachep, ve); } @@ -950,7 +949,6 @@ static int ve_state_show(struct seq_file *sf, void *v) case VE_STATE_STOPPING: seq_puts(sf, "STOPPING"); break; - case VE_STATE_STOPPED: case VE_STATE_DEAD: seq_puts(sf, "STOPPED"); break; -- 2.52.0 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
