[CRIU] [PATCH] Add pre-dump and pre-restore action scripts

Pavel Emelyanov xemul at parallels.com
Wed Oct 7 05:28:36 PDT 2015


> @@ -1736,6 +1736,14 @@ static int restore_root_task(struct pstree_item *init)
>  	enum trace_flags flag = TRACE_ALL;
>  	int ret, fd, mnt_ns_fd = -1;
>  
> +	ret = run_scripts(ACT_PRE_RESTORE);
> +	if (ret != 0) {
> +		pr_err("Aborting restore due to pre-restore script ret code %d\n", ret);
> +		timing_stop(TIME_RESTORE);
> +		write_stats(RESTORE_STATS);
> +		goto out_kill;

The out_kill is wrong fallback for error, it does things that
weren't yet initialized. Just return -1 (and no even need in
stopping timing and writing stats).

> +	}
> +
>  	fd = open("/proc", O_DIRECTORY | O_RDONLY);
>  	if (fd < 0) {
>  		pr_perror("Unable to open /proc");



More information about the CRIU mailing list