[CRIU] [PATCH] Add inherit fd support

Pavel Emelyanov xemul at parallels.com
Thu Dec 4 01:33:03 PST 2014


I only have two cosmetic comments :)

> diff --git a/files-reg.c b/files-reg.c
> index 20b50a0..2b22310 100644
> --- a/files-reg.c
> +++ b/files-reg.c
> @@ -962,6 +962,13 @@ int open_path(struct file_desc *d,
>  	}
>  
>  	mntns_root = mntns_get_root_by_mnt_id(rfi->rfe->mnt_id);
> +
> +	tmp = inherit_fd_lookup_id(rfi->path);
> +	if (tmp >= 0) {
> +		pr_info("File %s will be restored from fd %d\n", rfi->path, tmp);
> +		return tmp;
> +	}

Since the inherited fd doesn't depend on mntns_root lookup and remap dances above,
this can be moved to the beginning of the open_path(), can it?

> +
>  	tmp = open_cb(mntns_root, rfi, arg);
>  	if (tmp < 0) {
>  		pr_perror("Can't open file %s", rfi->path);

> @@ -503,6 +529,9 @@ static int dump_one_pipe(int lfd, u32 id, const struct fd_parms *p)
>  	if (pb_write_one(img_from_set(glob_imgset, CR_FD_PIPES), &pe, PB_PIPE))
>  		return -1;
>  
> +	if (inherit_fd_lookup_id(pipe_id_string(pe.pipe_id)) >= 0)
> +		return 0;
> +

This is probably not required, we decided to make --inherit-fd restore only option.

>  	return dump_one_pipe_data(&pd_pipes, lfd, p);
>  }
>  

Thanks,
Pavel



More information about the CRIU mailing list