[CRIU] [PATCH] scripts: Add ACT_POST_SIGRETURN stage

Pavel Emelyanov xemul at virtuozzo.com
Tue Jan 10 04:51:10 PST 2017


On 01/09/2017 05:44 PM, Cyrill Gorcunov wrote:
> The "post-sigreturn" action is when all tasks are restored
> but not yet restarted sitting in frozen/seized state, right
> after final rt-sigreturn call passed.
> 
> In vz7 this step is needed to tune up beancounters/cgroups
> params from the script, in vanilla criu it useful as well.

We have POST_RESTORE hook. If it happens too early (why?) let's
move it into proper place?

> Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
> ---
>  criu/action-scripts.c         | 1 +
>  criu/cr-restore.c             | 4 ++++
>  criu/include/action-scripts.h | 1 +
>  3 files changed, 6 insertions(+)
> 
> diff --git a/criu/action-scripts.c b/criu/action-scripts.c
> index 6a47d5e..d13de23 100644
> --- a/criu/action-scripts.c
> +++ b/criu/action-scripts.c
> @@ -26,6 +26,7 @@ static const char *action_names[ACT_MAX] = {
>  	[ ACT_POST_SETUP_NS ]	= "post-setup-namespaces",
>  	[ ACT_POST_RESUME ]	= "post-resume",
>  	[ ACT_POST_NET_LOCK ]	= "post-network-lock",
> +	[ ACT_POST_SIGRETURN ]	= "post-sigreturn",
>  };
>  
>  struct script {
> diff --git a/criu/cr-restore.c b/criu/cr-restore.c
> index d003f12..da6ed31 100644
> --- a/criu/cr-restore.c
> +++ b/criu/cr-restore.c
> @@ -1852,6 +1852,10 @@ static int restore_root_task(struct pstree_item *init)
>  	if (ret == 0)
>  		finalize_restore();
>  
> +	ret = run_scripts(ACT_POST_SIGRETURN);
> +	if (ret)
> +		pr_err("Post-sigreturn script ret code %d\n", ret);
> +
>  	if (restore_freezer_state())
>  		pr_err("Unable to restore freezer state\n");
>  
> diff --git a/criu/include/action-scripts.h b/criu/include/action-scripts.h
> index e49f57c..631350d 100644
> --- a/criu/include/action-scripts.h
> +++ b/criu/include/action-scripts.h
> @@ -12,6 +12,7 @@ enum script_actions {
>  	ACT_POST_SETUP_NS,
>  	ACT_POST_RESUME,
>  	ACT_POST_NET_LOCK,
> +	ACT_POST_SIGRETURN,
>  
>  	ACT_MAX
>  };
> 



More information about the CRIU mailing list