[CRIU] Re: [PATCH] restore: Order file restoring by their type

Cyrill Gorcunov gorcunov at openvz.org
Sat Apr 28 11:20:27 EDT 2012


On Sat, Apr 28, 2012 at 06:15:49PM +0400, Cyrill Gorcunov wrote:
> 
> Anyway, I'll not insist and will add explicit test.

Something like below? (don't apply it yet)

	Cyrill
---
From: Cyrill Gorcunov <gorcunov at openvz.org>
Subject: [PATCH] files: Open eventpoll file descriptors after regular files

epoll might use file descriptors as a source at time of
restore thus we need epolls to be restored at the very end.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 files.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/files.c b/files.c
index 2fd4ec0..8f3bd3c 100644
--- a/files.c
+++ b/files.c
@@ -654,12 +654,27 @@ int prepare_fds(struct pstree_item *me)
 
 	pr_info("%d: Opening fdinfo-s\n", me->pid);
 
-	for (state = 0; state < FD_STATE_MAX; state++)
+	for (state = 0; state < FD_STATE_MAX; state++) {
+		/*
+		 * We need eventpoll files to be restored at
+		 * the end, because they assume file descriptors
+		 * (found at chekpoint time) are already opened.
+		 */
 		list_for_each_entry(fle, &me->rst->fds, ps_list) {
+			if (fle->fe.type == FDINFO_EVENTPOLL)
+				continue;
+			ret = open_fdinfo(me->pid, &fle->fe, state);
+			if (ret)
+				goto done;
+		}
+		list_for_each_entry(fle, &me->rst->fds, ps_list) {
+			if (fle->fe.type != FDINFO_EVENTPOLL)
+				continue;
 			ret = open_fdinfo(me->pid, &fle->fe, state);
 			if (ret)
 				goto done;
 		}
+	}
 
 	ret = run_unix_connections();
 done:
-- 
1.7.7.6



More information about the CRIU mailing list