[PATCHv2,1/2] rpc: Add `remote` option

Submitted by Radostin Stoyanov on Feb. 12, 2018, 9:55 a.m.

Details

Message ID 20180212095545.14736-2-rstoyanov1@gmail.com
State New
Series "Add remote option to RPC"
Headers show

Commit Message

Radostin Stoyanov Feb. 12, 2018, 9:55 a.m.
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@gmail.com>
---
 criu/cr-service.c | 13 ++++++++-----
 images/rpc.proto  |  1 +
 2 files changed, 9 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

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 {