[CRIU] [PATCH 2/2] cg: Make lacking properties during restore non-fatal

gbellack at google.com gbellack at google.com
Thu Aug 14 11:39:17 PDT 2014


From: Garrison Bellack <gbellack at google.com>

Because different kernel versions have different cgroup properties, we might not
want criu to crash in the event of migration to a kernel with different
properties. Insteam, during restore, in the event of missing a property that was
dumped, print an error but continue.

Change-Id: I9bef72b8853dc0f1fb9d59ffb454abd14f2512a7
Signed-off-by: Garrison Bellack <gbellack at google.com>
---
 cgroup.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/cgroup.c b/cgroup.c
index 016ca6c..b727a50 100644
--- a/cgroup.c
+++ b/cgroup.c
@@ -932,8 +932,12 @@ static int restore_cgroup_prop(const CgroupPropEntry * cg_prop_entry_p,
 
 	f = fopenat(cg, path, "w+");
 	if (!f) {
-		pr_perror("Failed opening %s for writing\n", path);
-		return -1;
+		if (errno != ENOENT) {
+			pr_perror("Failed opening %s\n", path);
+			return -1;
+		}
+		pr_perror("Couldn't open %s. This cgroup property may not exist on this kernel\n", path);
+		return 0;
 	}
 
 	if (fprintf(f, "%s", cg_prop_entry_p->value) < 0) {
-- 
2.1.0.rc2.206.gedb03e5



More information about the CRIU mailing list