[CRIU] [PATCH 1/2] image: Introduce collect-nofree flag

Pavel Emelyanov xemul at virtuozzo.com
Fri May 26 06:02:27 PDT 2017


Current collect helper frees the pb entry if there's
zero priv_size on cinfo. For files we'll have zero
priv_size (as entries will be collected by sub-cinfos),
while the entry in question should NOT be freed.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/include/protobuf.h | 1 +
 criu/protobuf.c         | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/criu/include/protobuf.h b/criu/include/protobuf.h
index ff6136f..6097ba0 100644
--- a/criu/include/protobuf.h
+++ b/criu/include/protobuf.h
@@ -36,6 +36,7 @@ struct collect_image_info {
 };
 
 #define COLLECT_SHARED		0x1	/* use shared memory for obj-s */
+#define COLLECT_NOFREE		0x2	/* don't free entry after callback */
 #define COLLECT_HAPPENED	0x4	/* image was opened and collected */
 
 extern int collect_image(struct collect_image_info *);
diff --git a/criu/protobuf.c b/criu/protobuf.c
index 3db829d..5c770b8 100644
--- a/criu/protobuf.c
+++ b/criu/protobuf.c
@@ -217,7 +217,7 @@ int collect_image(struct collect_image_info *cinfo)
 			break;
 		}
 
-		if (!cinfo->priv_size)
+		if (!cinfo->priv_size && !(cinfo->flags & COLLECT_NOFREE))
 			cr_pb_descs[cinfo->pb_type].free(msg, NULL);
 	}
 
-- 
2.1.4



More information about the CRIU mailing list