[CRIU] [PATCH 1/2] Quick bug fix for move_in_cgroup() missing fd
Garrison Bellack
gbellack at google.com
Thu Aug 7 15:20:00 PDT 2014
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.
On Wed, Aug 6, 2014 at 10:46 AM, Pavel Emelyanov <xemul at parallels.com>
wrote:
> 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;
> > }
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20140807/1d86cd70/attachment.html>
More information about the CRIU
mailing list