[CRIU] [PATCH 12/15] restorer: don't need to restore pages content in restorer

Andrey Vagin avagin at openvz.org
Fri Nov 2 09:32:04 EDT 2012


All memory content are restored before entering in restorer.c.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 cr-restore.c       | 10 ----------
 include/restorer.h |  1 -
 restorer.c         | 22 ----------------------
 3 files changed, 33 deletions(-)

diff --git a/cr-restore.c b/cr-restore.c
index a5193f4..9749634 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1552,7 +1552,6 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
 	struct thread_restore_args *thread_args;
 
 	LIST_HEAD(self_vma_list);
-	int fd_pages = -1;
 	int i;
 
 	pr_info("Restore via sigreturn\n");
@@ -1578,12 +1577,6 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
 	BUILD_BUG_ON(SHMEMS_SIZE % PAGE_SIZE);
 	BUILD_BUG_ON(TASK_ENTRIES_SIZE % PAGE_SIZE);
 
-	fd_pages = open_image_ro(CR_FD_PAGES, pid);
-	if (fd_pages < 0) {
-		pr_perror("Can't open pages-%d", pid);
-		goto free;
-	}
-
 	restore_task_vma_len   = round_up(sizeof(*task_args), PAGE_SIZE);
 	restore_thread_vma_len = round_up(sizeof(*thread_args) * current->nr_threads, PAGE_SIZE);
 
@@ -1694,7 +1687,6 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
 	task_args->logfd	= log_get_fd();
 	task_args->loglevel	= log_get_loglevel();
 	task_args->sigchld_act	= sigchld_act;
-	task_args->fd_pages	= fd_pages;
 
 	strncpy(task_args->comm, core->tc->comm, sizeof(task_args->comm));
 
@@ -1821,8 +1813,6 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
 		: "rsp", "rdi", "rsi", "rbx", "rax", "memory");
 
 err:
-	close_safe(&fd_pages);
-free:
 	free_mappings(&self_vma_list);
 
 	/* Just to be sure */
diff --git a/include/restorer.h b/include/restorer.h
index bd9b35d..9997a0a 100644
--- a/include/restorer.h
+++ b/include/restorer.h
@@ -85,7 +85,6 @@ struct task_restore_core_args {
 	struct thread_restore_args	t;			/* thread group leader */
 
 	int				fd_exe_link;		/* opened self->exe file */
-	int				fd_pages;		/* opened pages dump file */
 	int				logfd;
 	unsigned int			loglevel;
 
diff --git a/restorer.c b/restorer.c
index c477c65..49923f3 100644
--- a/restorer.c
+++ b/restorer.c
@@ -483,28 +483,6 @@ long __export_restore_task(struct task_restore_core_args *args)
 	}
 
 	/*
-	 * Read page contents.
-	 */
-	while (1) {
-		ret = sys_read(args->fd_pages, &va, sizeof(va));
-		if (!ret)
-			break;
-
-		if (ret != sizeof(va)) {
-			pr_err("Bad mapping page size %ld\n", ret);
-			goto core_restore_end;
-		}
-
-		ret = sys_read(args->fd_pages, (void *)va, PAGE_SIZE);
-		if (ret != PAGE_SIZE) {
-			pr_err("Can'r read mapping page %ld\n", ret);
-			goto core_restore_end;
-		}
-	}
-
-	sys_close(args->fd_pages);
-
-	/*
 	 * Walk though all VMAs again to drop PROT_WRITE
 	 * if it was not there.
 	 */
-- 
1.7.11.7



More information about the CRIU mailing list