2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00

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 <minhquangbui99@gmail.com>
This commit is contained in:
Bui Quang Minh 2023-03-16 23:05:46 +07:00 committed by Andrei Vagin
parent 6e681afb69
commit 529f298913
2 changed files with 3 additions and 2 deletions

View File

@ -930,6 +930,7 @@ static int dump_controllers(CgroupEntry *cg)
list_for_each_entry(cur, &cgroups, l) { list_for_each_entry(cur, &cgroups, l) {
cg_controller_entry__init(ce); cg_controller_entry__init(ce);
ce->has_is_threaded = true;
ce->is_threaded = cur->is_threaded; ce->is_threaded = cur->is_threaded;
ce->cnames = cur->controllers; ce->cnames = cur->controllers;
ce->n_cnames = cur->n_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 * process must be in this controller. Main thread has been
* restored, so this thread is in this controller already. * restored, so this thread is in this controller already.
*/ */
if (!ctrl->is_threaded) if (!ctrl->has_is_threaded || !ctrl->is_threaded)
continue; continue;
aux_off = ctrl_dir_and_opt(ctrl, aux, sizeof(aux), NULL, 0); aux_off = ctrl_dir_and_opt(ctrl, aux, sizeof(aux), NULL, 0);

View File

@ -24,7 +24,7 @@ message cgroup_dir_entry {
message cg_controller_entry { message cg_controller_entry {
repeated string cnames = 1; repeated string cnames = 1;
repeated cgroup_dir_entry dirs = 2; repeated cgroup_dir_entry dirs = 2;
required bool is_threaded = 3; optional bool is_threaded = 3;
} }
message cg_member_entry { message cg_member_entry {