[CRIU] [PATCH] restorer: move vma flags ANON bit drop alter IPC check

Kinsbursky Stanislav skinsbursky at openvz.org
Fri Feb 17 05:23:27 EST 2012


This doesn't change anything. But looks clearer, because this check has
nothing with SYSV IPC mappings.

Signed-off-by: Stanislav Kinsbursky <skinsbursky at openvz.org>

---
 restorer.c |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/restorer.c b/restorer.c
index 3eb5e35..e686dc3 100644
--- a/restorer.c
+++ b/restorer.c
@@ -295,6 +295,18 @@ static u64 restore_mapping(const struct vma_entry *vma_entry)
 		return sys_shmat(vma_entry->fd, (void *)vma_entry->start,
 				 (vma_entry->prot & PROT_WRITE) ? 0 : SHM_RDONLY);
 
+	/*
+	 * Restore or shared mappings are tricky, since
+	 * we open anonymous mapping via map_files/
+	 * MAP_ANONYMOUS should be eliminated so fd would
+	 * be taken into account by a kernel.
+	 */
+	if (vma_entry_is(vma_entry, VMA_ANON_SHARED)) {
+		if (vma_entry->fd != -1UL)
+			vma_entry->flags &= ~MAP_ANONYMOUS;
+	}
+
+
 	prot = vma_entry->prot;
 
 	/* A mapping of file with MAP_SHARED is up to date */
@@ -401,17 +413,6 @@ long restore_task(struct task_restore_core_args *args)
 		if (!vma_entry_is(vma_entry, VMA_AREA_REGULAR))
 			continue;
 
-		/*
-		 * Restore or shared mappings are tricky, since
-		 * we open anonymous mapping via map_files/
-		 * MAP_ANONYMOUS should be eliminated so fd would
-		 * be taken into account by a kernel.
-		 */
-		if (vma_entry_is(vma_entry, VMA_ANON_SHARED)) {
-			if (vma_entry->fd != -1UL)
-				vma_entry->flags &= ~MAP_ANONYMOUS;
-		}
-
 		va = restore_mapping(vma_entry);
 
 		if (va != vma_entry->start) {



More information about the CRIU mailing list