[CRIU] [PATCH 2/3] files: Remove support for per-pid fdinfo-s

Pavel Emelyanov xemul at virtuozzo.com
Thu Jun 16 07:50:15 PDT 2016


Since 0.3 fdinfo image is ID-s based, so old ones are not used at all.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/files.c         | 20 +++++++-------------
 criu/image.c         |  7 +++++--
 criu/include/image.h |  1 -
 3 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/criu/files.c b/criu/files.c
index b9fdbdc..719d0be 100644
--- a/criu/files.c
+++ b/criu/files.c
@@ -769,21 +769,15 @@ int prepare_fd_pid(struct pstree_item *item)
 	INIT_LIST_HEAD(&rst_info->tty_slaves);
 	INIT_LIST_HEAD(&rst_info->tty_ctty);
 
-	if (!fdinfo_per_id) {
-		img = open_image(CR_FD_FDINFO, O_RSTR, pid);
-		if (!img)
-			return -1;
-	} else {
-		if (item->ids == NULL) /* zombie */
-			return 0;
+	if (item->ids == NULL) /* zombie */
+		return 0;
 
-		if (rsti(item)->fdt && rsti(item)->fdt->pid != item->pid.virt)
-			return 0;
+	if (rsti(item)->fdt && rsti(item)->fdt->pid != item->pid.virt)
+		return 0;
 
-		img = open_image(CR_FD_FDINFO, O_RSTR, item->ids->files_id);
-		if (!img)
-			return -1;
-	}
+	img = open_image(CR_FD_FDINFO, O_RSTR, item->ids->files_id);
+	if (!img)
+		return -1;
 
 	while (1) {
 		FdinfoEntry *e;
diff --git a/criu/image.c b/criu/image.c
index cff9edd..a3bb285 100644
--- a/criu/image.c
+++ b/criu/image.c
@@ -14,7 +14,6 @@
 #include "images/inventory.pb-c.h"
 #include "images/pagemap.pb-c.h"
 
-bool fdinfo_per_id = false;
 bool ns_per_id = false;
 bool img_common_magic = true;
 TaskKobjIdsEntry *root_ids;
@@ -34,7 +33,11 @@ int check_img_inventory(void)
 	if (pb_read_one(img, &he, PB_INVENTORY) < 0)
 		goto out_close;
 
-	fdinfo_per_id = he->has_fdinfo_per_id ?  he->fdinfo_per_id : false;
+	if (!he->has_fdinfo_per_id || !he->fdinfo_per_id) {
+		pr_err("Too old image, no longer supported\n");
+		goto out_close;
+	}
+
 	ns_per_id = he->has_ns_per_id ? he->ns_per_id : false;
 
 	if (he->root_ids) {
diff --git a/criu/include/image.h b/criu/include/image.h
index 476a096..65b7b0a 100644
--- a/criu/include/image.h
+++ b/criu/include/image.h
@@ -96,7 +96,6 @@
 
 #define CR_PARENT_LINK "parent"
 
-extern bool fdinfo_per_id;
 extern bool ns_per_id;
 extern bool img_common_magic;
 
-- 
2.5.0



More information about the CRIU mailing list