[CRIU] [PATCH 1/2] rpc: Add `remote` option

Radostin Stoyanov rstoyanov1 at gmail.com
Mon Feb 12 10:58:49 MSK 2018


Use the resolved `images_dir` path instead of fd path stored in
`images_dir_path` to ensure that init_snapshot_id() will work properly.

Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
---
 criu/cr-service.c | 13 ++++++++-----
 images/rpc.proto  |  1 +
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/criu/cr-service.c b/criu/cr-service.c
index 274ff218..16062736 100644
--- a/criu/cr-service.c
+++ b/criu/cr-service.c
@@ -260,20 +260,23 @@ static int setup_opts_from_req(int sk, CriuOpts *req)
 	/* open images_dir */
 	sprintf(images_dir_path, "/proc/%d/fd/%d", ids.pid, req->images_dir_fd);
 
+	if (req->remote)
+		opts.remote = true;
+
 	if (req->parent_img)
 		opts.img_parent = req->parent_img;
 
-	if (open_image_dir(images_dir_path) < 0) {
-		pr_perror("Can't open images directory");
-		goto err;
-	}
-
 	/* get full path to images_dir to use in process title */
 	if (readlink(images_dir_path, images_dir, PATH_MAX) == -1) {
 		pr_perror("Can't readlink %s", images_dir_path);
 		goto err;
 	}
 
+	if (open_image_dir(images_dir) < 0) {
+		pr_perror("Can't open images directory");
+		goto err;
+	}
+
 	/* chdir to work dir */
 	if (req->has_work_dir_fd)
 		sprintf(work_dir_path, "/proc/%d/fd/%d", ids.pid, req->work_dir_fd);
diff --git a/images/rpc.proto b/images/rpc.proto
index 71f47d59..d69251bc 100644
--- a/images/rpc.proto
+++ b/images/rpc.proto
@@ -111,6 +111,7 @@ message criu_opts {
 	optional bool			lazy_pages		= 48;
 	optional int32			status_fd		= 49;
 	optional bool			orphan_pts_master	= 50;
+	optional bool			remote			= 51;
 }
 
 message criu_dump_resp {
-- 
2.14.3



More information about the CRIU mailing list