From 529f29891349eadf89e7ff0c96c208b08cadb89e Mon Sep 17 00:00:00 2001 From: Bui Quang Minh Date: Thu, 16 Mar 2023 23:05:46 +0700 Subject: [PATCH] cgroup-v2: make new field is_threaded optional The new field is_threaded is currently marked as required which causes backward compatibility problem when using newer CRIU version to restore dumped image from older version. This commit makes this field optional and reworks the logic the skip fixing up threaded cgroup controllers if there is no information in dumped image. Signed-off-by: Bui Quang Minh --- criu/cgroup.c | 3 ++- images/cgroup.proto | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/criu/cgroup.c b/criu/cgroup.c index 0c730713a..8243ac6d3 100644 --- a/criu/cgroup.c +++ b/criu/cgroup.c @@ -930,6 +930,7 @@ static int dump_controllers(CgroupEntry *cg) list_for_each_entry(cur, &cgroups, l) { cg_controller_entry__init(ce); + ce->has_is_threaded = true; ce->is_threaded = cur->is_threaded; ce->cnames = cur->controllers; ce->n_cnames = cur->n_controllers; @@ -2002,7 +2003,7 @@ static int cgroupd(int sk) * process must be in this controller. Main thread has been * restored, so this thread is in this controller already. */ - if (!ctrl->is_threaded) + if (!ctrl->has_is_threaded || !ctrl->is_threaded) continue; aux_off = ctrl_dir_and_opt(ctrl, aux, sizeof(aux), NULL, 0); diff --git a/images/cgroup.proto b/images/cgroup.proto index 5c7d16c6d..02f226835 100644 --- a/images/cgroup.proto +++ b/images/cgroup.proto @@ -24,7 +24,7 @@ message cgroup_dir_entry { message cg_controller_entry { repeated string cnames = 1; repeated cgroup_dir_entry dirs = 2; - required bool is_threaded = 3; + optional bool is_threaded = 3; } message cg_member_entry {