[CRIU] [PATCH 23/28] dump: dump vma after collect

Kinsbursky Stanislav skinsbursky at openvz.org
Thu Mar 22 14:00:06 EDT 2012


From: Stanislav Kinsbursky <skinsbursky at openvz.org>

To make sure, then vma shmid was updated.

Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>
---
 cr-dump.c |   22 +++++++++++-----------
 cr-show.c |   17 ++---------------
 2 files changed, 13 insertions(+), 26 deletions(-)
-------------- next part --------------
diff --git a/cr-dump.c b/cr-dump.c
index 2a4edbc..7fb9e83 100644
--- a/cr-dump.c
+++ b/cr-dump.c
@@ -495,17 +495,6 @@ static int dump_task_mappings(pid_t pid, const struct list_head *vma_area_list,
 	list_for_each_entry(vma_area, vma_area_list, list) {
 		struct vma_entry *vma = &vma_area->vma;
 
-		ret = write_img(fd, vma);
-		if (ret < 0)
-			goto err;
-
-		if (!vma_entry_is(vma, VMA_AREA_REGULAR))
-			continue;
-		if (vma_entry_is(vma, VMA_AREA_SYSVIPC))
-			continue;
-
-		pr_info_vma(vma_area);
-
 		if (vma_entry_is(vma, VMA_ANON_SHARED))
 			ret = add_shmem_area(pid, vma);
 		else if (vma_entry_is(vma, VMA_FILE_PRIVATE) ||
@@ -516,6 +505,17 @@ static int dump_task_mappings(pid_t pid, const struct list_head *vma_area_list,
 
 		if (ret)
 			goto err;
+
+		ret = write_img(fd, vma);
+		if (ret < 0)
+			goto err;
+
+		if (!vma_entry_is(vma, VMA_AREA_REGULAR))
+			continue;
+		if (vma_entry_is(vma, VMA_AREA_SYSVIPC))
+			continue;
+
+		pr_info_vma(vma_area);
 	}
 
 	ret = 0;
diff --git a/cr-show.c b/cr-show.c
index 76cc137..346bf2c 100644
--- a/cr-show.c
+++ b/cr-show.c
@@ -67,21 +67,8 @@ static void show_files(int fd_files)
 		if (ret <= 0)
 			goto out;
 
-		pr_msg("type: %02x id: %16lx len: %02x flags: %4x pos: %8x "
-		       "addr: %16lx",
-		       e.fde.type, e.fde.id, e.len, e.flags, e.pos, e.addr);
-
-		if (e.len) {
-			int ret = read(fd_files, local_buf, e.len);
-			if (ret != e.len) {
-				pr_perror("Can't read %d bytes", e.len);
-				goto out;
-			}
-			local_buf[e.len] = 0;
-			pr_msg(" --> %s", local_buf);
-		}
-
-		pr_msg("\n");
+		pr_msg("type: %02d id: %20ld fd: %d\n",
+		       e.fde.type, e.fde.id, e.fde.fd);
 	}
 
 out:


More information about the CRIU mailing list