[CRIU] [PATCH 1/4] remap: add remap_type field and use it
Andrew Vagin
avagin at parallels.com
Mon Sep 15 07:08:48 PDT 2014
[root at avagin-fc19-cr criu]# bash test/zdtm.sh ns/static/cwd01
Execute zdtm/live/static/cwd01
./cwd01 --pidfile=cwd01.pid --outfile=cwd01.out --dirname=cwd01.test
/root/git/criu/test
Dump 7563
Restore
Check results 7592
test/zdtm.sh: line 461: kill: (7592) - No such process
Unable to stop cwd01 (7592)
Test: zdtm/live/static/cwd01, Result: FAIL
==================================== ERROR ====================================
Test: zdtm/live/static/cwd01, Namespace: 1
Dump log : /root/git/criu/test/dump/static/cwd01/7563/1/dump.log
--------------------------------- grep Error ---------------------------------
------------------------------------- END -------------------------------------
Restore log: /root/git/criu/test/dump/static/cwd01/7563/1/restore.log
--------------------------------- grep Error ---------------------------------
(00.048617) 1: Error (image.c:217): Unable to open ghost-file-0.img: No such file or directory
(00.048731) Error (cr-restore.c:1781): Restoring FAILED.
------------------------------------- END -------------------------------------
================================= ERROR OVER =================================
On Fri, Sep 12, 2014 at 07:43:28PM -0500, Tycho Andersen wrote:
> Maintain backwards compatibility for old images, but don't set the REMAP_GHOST
> bit going forward, only use the remap_type field.
>
> Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> ---
> files-reg.c | 31 ++++++++++++++++++++++++-------
> protobuf/remap-file-path.proto | 6 ++++++
> 2 files changed, 30 insertions(+), 7 deletions(-)
>
> diff --git a/files-reg.c b/files-reg.c
> index 0ffce0e..835911a 100644
> --- a/files-reg.c
> +++ b/files-reg.c
> @@ -131,7 +131,6 @@ static int open_remap_ghost(struct reg_file_info *rfi,
> int ifd;
> char *root;
>
> - rfe->remap_id &= ~REMAP_GHOST;
> list_for_each_entry(gf, &ghost_files, list)
> if (gf->id == rfe->remap_id)
> goto gf_found;
> @@ -246,10 +245,29 @@ static int collect_one_remap(void *obj, ProtobufCMessage *msg)
> rfi = container_of(fdesc, struct reg_file_info, d);
> pr_info("Configuring remap %#x -> %#x\n", rfi->rfe->id, rfe->remap_id);
>
> - if (rfe->remap_id & REMAP_GHOST)
> - ret = open_remap_ghost(rfi, rfe);
> - else
> +
> + if (!rfe->has_remap_type) {
> + rfe->has_remap_type = true;
> + /* backward compatibility with images */
> + if (rfe->remap_id & REMAP_GHOST) {
> + rfe->remap_id &= ~REMAP_GHOST;
> + rfe->remap_type = REMAP_TYPE__GHOST;
> + } else
> + rfe->remap_type = REMAP_TYPE__LINKED;
> + }
> +
> + switch (rfe->remap_type) {
> + case REMAP_TYPE__LINKED:
> ret = open_remap_linked(rfi, rfe);
> + break;
> + case REMAP_TYPE__GHOST:
> + ret = open_remap_ghost(rfi, rfe);
> + break;
> + default:
> + pr_err("unknown remap type %u\n", rfe->remap_type);
> + goto out;
> + }
> +
> out:
> return ret;
> }
> @@ -375,10 +393,9 @@ static int dump_ghost_remap(char *path, const struct stat *st,
> return -1;
>
> dump_entry:
> - BUG_ON(gf->id & REMAP_GHOST);
> -
> rpe.orig_id = id;
> - rpe.remap_id = gf->id | REMAP_GHOST;
> + rpe.has_remap_type = true;
> + rpe.remap_type = REMAP_TYPE__GHOST;
>
> return pb_write_one(fdset_fd(glob_fdset, CR_FD_REMAP_FPATH),
> &rpe, PB_REMAP_FPATH);
> diff --git a/protobuf/remap-file-path.proto b/protobuf/remap-file-path.proto
> index faeb745..cb8568f 100644
> --- a/protobuf/remap-file-path.proto
> +++ b/protobuf/remap-file-path.proto
> @@ -1,4 +1,10 @@
> +enum remap_type {
> + LINKED = 0;
> + GHOST = 1;
> +};
> +
> message remap_file_path_entry {
> required uint32 orig_id = 1;
> required uint32 remap_id = 2;
> + optional uint32 remap_type = 3;
> }
> --
> 1.9.1
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
More information about the CRIU
mailing list