[CRIU] [PATCH 1/2] Re-create cgroups if necessary

Tycho Andersen tycho.andersen at canonical.com
Tue Jun 24 06:38:36 PDT 2014


Hi Pavel,

On Tue, Jun 24, 2014 at 10:53:26AM +0400, Pavel Emelyanov wrote:
> On 06/23/2014 07:54 PM, Tycho Andersen wrote:
> > If a task had cgroups, these should be restored. (Also any properties of
> > cgroups, but this commit doesn't do that yet.)
> > 
> > Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> > ---
> >  cgroup.c       |  6 +++++-
> >  include/util.h |  5 +++++
> >  util.c         | 26 ++++++++++++++++++++++++++
> >  3 files changed, 36 insertions(+), 1 deletion(-)
> > 
> > diff --git a/cgroup.c b/cgroup.c
> > index 2d9ebad..8b2deb2 100644
> > --- a/cgroup.c
> > +++ b/cgroup.c
> > @@ -258,9 +258,13 @@ static int move_in_cgroup(CgSetEntry *se)
> >  		int fd, err;
> >  		ControllerEntry *ce = se->ctls[i];
> >  
> > +		sprintf(aux, "%s/%s", ce->name, ce->path);
> > +		if (mkdirpat(cg, aux) < 0)
> > +			return -1;
> > +
> >  		sprintf(aux, "%s/%s/tasks", ce->name, ce->path);
> >  		pr_debug("  `-> %s\n", aux);
> > -		err = fd = openat(cg, aux, O_WRONLY);
> > +		err = fd = openat(cg, aux, O_WRONLY | O_CREAT, 0700);
> 
> Why O_CREAT here? The cgroup files should just exist.

I guess it won't exist if the directory is created by mpdirpat above,
although maybe as you mentioned in the other thread we need to do more
here.

Tycho


More information about the CRIU mailing list