[CRIU] [Q] cgroup roots rewritting

Tycho Andersen tycho.andersen at canonical.com
Mon May 16 13:57:48 PDT 2016


On Mon, May 16, 2016 at 10:27:36PM +0300, Cyrill Gorcunov wrote:
> Hi Tycho! In commit
> 
> commit 16d3fdef31d70958cdd8adfa67847c308416fccd
> Author: Tycho Andersen <tycho.andersen at canonical.com>
> Date:   Wed Mar 2 16:17:04 2016 -0700
> 
>     cgroup: fix --cgroup-root and cgns interaction
> 
> you made the following trick:
> 
> 				...
> 				/* otherwise, use the old rewriting strategy */
> 				cg->path = xsprintf("%s%s", to, cg->path +
> 							strlen(*from) + 1);
> 				if (!set_from) {
> 					set_from = true;
> 					tmp2 = *from;
> 					*from = xstrdup(to);
> 				}
> 
> And I dont understand why we change @from here. Imagine you have
> a several sets of controller all laying in cgroup 300. Then
> we need to change it to say 400, and once first match hit
> we change source 300 to 400 here and continue trying to
> compare with it. Which is wrong I this -- the strstartswith
> no longer match old '300' ones for the rest of the set.
> What I'm missing here?

I think we have to change the *from there, because if you don't you
end up with cg sets that have been rewritten, but CgroupDirEntrys
which haven't been.

I agree that the logic to change *from is wrong, though. Probably I
never noticed because there aren't usually very many cg sets :). I
think it should be that we still rewrite *from, but only at the very
end, once we have iterated through all the cg sets. Does that make
sense?

> We hit a problem when been renaming suspended container --
> on restore we give it a new name (400) and criu can't
> move taks in nonexisting cgroup 300, which container
> had befor the renaming (of course in image all controllers
> and sets have old 300 in dirs and paths).

I suppose you are using --cgroup-root here?

Tycho

> Could you please elaborate which scenario this commit
> addresses? Actually the comment in code didn't help much :)
> 
> 	Cyrill


More information about the CRIU mailing list