[CRIU] [PATCH RFC v2 14/14] files: Debug make receive stage last

Kirill Tkhai ktkhai at virtuozzo.com
Fri Oct 28 14:08:02 PDT 2016


This patch is just for debug purpose, its goal is to check
that deadlocks do not happen.

The only thing just of changing the order we need to do,
it to fix ctl tty logic a little bit. It may be slave, and
when it's used in post_open this case, it should be already
received.

THIS PATCH WILL NOT GO ANYWHERE!

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/files.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/criu/files.c b/criu/files.c
index 7be9f3e..e48dd96 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -867,8 +867,8 @@ static int post_open_fd(int pid, struct fdinfo_list_entry *fle);
 
 static struct fd_open_state states[] = {
 	{ "create",		open_fd,	},
-	{ "receive",		receive_fd,	},
 	{ "post_create",	post_open_fd,	},
+	{ "receive",		receive_fd,	},
 };
 
 static void transport_name_gen(struct sockaddr_un *addr, int *len, int pid)
@@ -978,8 +978,13 @@ static int post_open_fd(int pid, struct fdinfo_list_entry *fle)
 	if (!d->ops->post_open)
 		return 0;
 
-	if (is_service_fd(fle->fe->fd, CTL_TTY_OFF))
+	if (is_service_fd(fle->fe->fd, CTL_TTY_OFF)) {
+		if (receive_fd(pid, fle) < 0) {
+			pr_err("Can't receive\n");
+			return -1;
+		}
 		return d->ops->post_open(d, fle->fe->fd);
+	}
 
 	if (fle != file_master(d))
 		return 0;
@@ -1044,6 +1049,9 @@ static int receive_fd(int pid, struct fdinfo_list_entry *fle)
 	if (flem->pid == pid)
 		return 0;
 
+	if (fle->received)
+		return 0;
+
 	pr_info("\tReceive fd for %d\n", fle->fe->fd);
 
 	fd = recv_fd_from_peer(fle);



More information about the CRIU mailing list