<div dir="ltr">Pavel, after looking into it more yesterday, I came to the same realization and the exact same solution. I just saw your email today as I was going to send my revised bug fix patch. I will send the updated patch momentarily. </div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Aug 6, 2014 at 10:46 AM, Pavel Emelyanov <span dir="ltr"><<a href="mailto:xemul@parallels.com" target="_blank">xemul@parallels.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 08/05/2014 11:50 PM, <a href="mailto:gbellack@google.com">gbellack@google.com</a> wrote:<br>
> From: gbellack <<a href="mailto:gbellack@google.com">gbellack@google.com</a>><br>
><br>
> There is an issue where if the proccess to be killed spawns a child proccess and<br>
> moves it in a child cgroup of the one the parent proccess is in, upon restore,<br>
> move_in_cgroup() is called twice as it should be (once to move the parent<br>
> proccess and once to move the child proccess) but the file descriptor has<br>
> already been closed causing a failure for the second call to move_in_cgroup().<br>
<br>
</div>I've reproduced this issue locally. The problem is that cgyard service<br>
descriptor is closed before children tasks are forked, while it should<br>
not. The fix should be like this:<br>
<br>
diff --git a/cgroup.c b/cgroup.c<br>
index 06311e4..21ca330 100644<br>
--- a/cgroup.c<br>
+++ b/cgroup.c<br>
@@ -617,7 +618,6 @@ static int move_in_cgroup(CgSetEntry *se)<br>
}<br>
}<br>
<br>
- close_service_fd(CGROUP_YARD);<br>
return 0;<br>
}<br>
<br>
@@ -636,7 +636,6 @@ int prepare_task_cgroup(struct pstree_item *me)<br>
<br>
if (me->rst->cg_set == current_cgset) {<br>
pr_info("Cgroups %d inherited from parent\n", current_cgset);<br>
- close_service_fd(CGROUP_YARD);<br>
return 0;<br>
}<br>
<br>
diff --git a/cr-restore.c b/cr-restore.c<br>
index 7569afa..0b182f0 100644<br>
--- a/cr-restore.c<br>
+++ b/cr-restore.c<br>
@@ -1313,6 +1313,8 @@ static int restore_task_with_children(void *_arg)<br>
if (create_children_and_session())<br>
goto err;<br>
<br>
+ close_service_fd(CGROUP_YARD);<br>
+<br>
if (restore_task_mnt_ns(current))<br>
goto err;<br>
<br>
<br>
Can you confirm this fixes your issue?<br>
<div class="HOEnZb"><div class="h5"><br>
> Change-Id: I6ae88b95c5410a7f56108e28eb3133f113e868d0<br>
> Signed-off-by: Garrison Bellack <<a href="mailto:gbellack@google.com">gbellack@google.com</a>><br>
> ---<br>
> cgroup.c | 1 -<br>
> 1 file changed, 1 deletion(-)<br>
><br>
> diff --git a/cgroup.c b/cgroup.c<br>
> index 06311e4..8c99e9d 100644<br>
> --- a/cgroup.c<br>
> +++ b/cgroup.c<br>
> @@ -617,7 +617,6 @@ static int move_in_cgroup(CgSetEntry *se)<br>
> }<br>
> }<br>
><br>
> - close_service_fd(CGROUP_YARD);<br>
> return 0;<br>
> }<br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div>