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

Andrey Vagin avagin at openvz.org
Wed Nov 14 12:19:22 EST 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 f9da783..ef297c8 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1564,7 +1564,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");
@@ -1590,12 +1589,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);
 
@@ -1705,7 +1698,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));
 
@@ -1835,8 +1827,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 6f7dc36..51b5ddf 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 bf01f66..4951012 100644
--- a/restorer.c
+++ b/restorer.c
@@ -510,28 +510,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