[CRIU] [PATCH 1/2] Quick bug fix for move_in_cgroup() missing fd
Pavel Emelyanov
xemul at parallels.com
Wed Aug 6 10:46:09 PDT 2014
On 08/05/2014 11:50 PM, gbellack at google.com wrote:
> From: gbellack <gbellack at google.com>
>
> There is an issue where if the proccess to be killed spawns a child proccess and
> moves it in a child cgroup of the one the parent proccess is in, upon restore,
> move_in_cgroup() is called twice as it should be (once to move the parent
> proccess and once to move the child proccess) but the file descriptor has
> already been closed causing a failure for the second call to move_in_cgroup().
I've reproduced this issue locally. The problem is that cgyard service
descriptor is closed before children tasks are forked, while it should
not. The fix should be like this:
diff --git a/cgroup.c b/cgroup.c
index 06311e4..21ca330 100644
--- a/cgroup.c
+++ b/cgroup.c
@@ -617,7 +618,6 @@ static int move_in_cgroup(CgSetEntry *se)
}
}
- close_service_fd(CGROUP_YARD);
return 0;
}
@@ -636,7 +636,6 @@ int prepare_task_cgroup(struct pstree_item *me)
if (me->rst->cg_set == current_cgset) {
pr_info("Cgroups %d inherited from parent\n", current_cgset);
- close_service_fd(CGROUP_YARD);
return 0;
}
diff --git a/cr-restore.c b/cr-restore.c
index 7569afa..0b182f0 100644
--- a/cr-restore.c
+++ b/cr-restore.c
@@ -1313,6 +1313,8 @@ static int restore_task_with_children(void *_arg)
if (create_children_and_session())
goto err;
+ close_service_fd(CGROUP_YARD);
+
if (restore_task_mnt_ns(current))
goto err;
Can you confirm this fixes your issue?
> Change-Id: I6ae88b95c5410a7f56108e28eb3133f113e868d0
> Signed-off-by: Garrison Bellack <gbellack at google.com>
> ---
> cgroup.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/cgroup.c b/cgroup.c
> index 06311e4..8c99e9d 100644
> --- a/cgroup.c
> +++ b/cgroup.c
> @@ -617,7 +617,6 @@ static int move_in_cgroup(CgSetEntry *se)
> }
> }
>
> - close_service_fd(CGROUP_YARD);
> return 0;
> }
>
>
More information about the CRIU
mailing list