[v4,09/19] sfds: Populate pid proc

Submitted by Kirill Tkhai on Jan. 10, 2018, 2:01 p.m.

Details

Message ID 151559291141.31108.6253177619453075782.stgit@localhost.localdomain
State Accepted
Series "Introduce custom per-task service fds placement"
Commit cdcfe1d5ae5161434b6ce0491162a91149495b11
Headers show

Commit Message

Kirill Tkhai Jan. 10, 2018, 2:01 p.m.
This patch populates/occupies PROC_FD_OFF fd number,
which is goint to be replaced atomically in next patches.

v4: New

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 criu/cr-restore.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

Patch hide | download patch | download mbox

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 49d367e4c..2534575a4 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -529,6 +529,15 @@  static int populate_root_fd_off(void)
 	return ret >= 0 ? 0 : -1;
 }
 
+static int populate_pid_proc(void)
+{
+	if (open_pid_proc(vpid(current)) < 0) {
+		pr_err("Can't open PROC_SELF\n");
+		return -1;
+	}
+	return 0;
+}
+
 static rt_sigaction_t sigchld_act;
 /*
  * If parent's sigaction has blocked SIGKILL (which is non-sence),
@@ -1912,6 +1921,9 @@  static int restore_task_with_children(void *_arg)
 
 	timing_stop(TIME_FORK);
 
+	if (populate_pid_proc())
+		goto err;
+
 	if (unmap_guard_pages(current))
 		goto err;