<div dir="ltr">Sorry, the last patch is missing an &quot;else&quot;.<div><br></div><div><div>diff --git a/cgroup.c b/cgroup.c</div><div>index d2185fb..60b560c 100644</div><div>--- a/cgroup.c</div><div>+++ b/cgroup.c</div><div>
@@ -373,7 +373,7 @@ static int prepare_cgroup_sfd(CgSetEntry *root_set)</div><div>                        sprintf(paux + off, &quot;/%s&quot;, ce-&gt;name + 5);</div><div>                        sprintf(aux, &quot;none,%s&quot;, ce-&gt;name);</div>
<div>                        opt = aux;</div><div>-               }</div><div>+               } else</div><div>                        sprintf(paux + off, &quot;/%s&quot;, ce-&gt;name);</div><div> </div><div>                if (mkdir(paux, 0700)) {</div>
</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jun 20, 2014 at 4:54 PM, Saied Kazemi <span dir="ltr">&lt;<a href="mailto:saied@google.com" target="_blank">saied@google.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">The restore code in CRIU 1.3rc2 for cgroups does not seem to correctly handle named hierarchies.  A named hierarchy can be created by &quot;mount -t cgroup -o none,name=&lt;name&gt; &lt;source&gt; &lt;target&gt;&quot;.  One such named cgroup is systemd.  Below is a snippet of the cgroup image file after CRIU dump showing the entry for systemd.<div>


<br></div><div># criu show -f img/cgroup.img </div><div>...</div><div><div>:{</div><div><span style="white-space:pre-wrap">                </span>name: &quot;name=systemd&quot;</div><div><span style="white-space:pre-wrap">                </span>path: &quot;/user/1000.user/4.session&quot;</div>


<div><span style="white-space:pre-wrap">        </span>}</div></div><div>...</div><div><br></div><div>The function prepare_cgroup_sfd() creates a directory called &quot;name=systemd&quot; and mounts it.</div><div><br></div><div>


I applied the following patch as a quick workaround but I think the issue needs further study.</div><div><br></div><div><div>diff --git a/cgroup.c b/cgroup.c</div><div>index 2d9ebad..d2185fb 100644</div><div>--- a/cgroup.c</div>

<div>+++ b/cgroup.c</div><div>@@ -258,7 +258,10 @@ static int move_in_cgroup(CgSetEntry *se)</div><div>                int fd, err;</div><div>                ControllerEntry *ce = se-&gt;ctls[i];</div><div> </div><div>-               sprintf(aux, &quot;%s/%s/tasks&quot;, ce-&gt;name, ce-&gt;path);</div>

<div>+               if (strstartswith(ce-&gt;name, &quot;name=&quot;))</div><div>+                       sprintf(aux, &quot;%s/%s/tasks&quot;, ce-&gt;name + 5, ce-&gt;path);</div><div>+               else</div><div>+                       sprintf(aux, &quot;%s/%s/tasks&quot;, ce-&gt;name, ce-&gt;path);</div>

<div>                pr_debug(&quot;  `-&gt; %s\n&quot;, aux);</div><div>                err = fd = openat(cg, aux, O_WRONLY);</div><div>                if (fd &gt;= 0) {</div><div>@@ -366,11 +369,12 @@ static int prepare_cgroup_sfd(CgSetEntry *root_set)</div>

<div>                ControllerEntry *ce = root_set-&gt;ctls[i];</div><div>                char *opt = ce-&gt;name;</div><div> </div><div>-               sprintf(paux + off, &quot;/%s&quot;, ce-&gt;name);</div><div>                if (strstartswith(ce-&gt;name, &quot;name=&quot;)) {</div>

<div>+                       sprintf(paux + off, &quot;/%s&quot;, ce-&gt;name + 5);</div><div>                        sprintf(aux, &quot;none,%s&quot;, ce-&gt;name);</div><div>                        opt = aux;</div><div>

                }</div><div>+                       sprintf(paux + off, &quot;/%s&quot;, ce-&gt;name);</div><div> </div><div>                if (mkdir(paux, 0700)) {</div><div>                        pr_perror(&quot;Can&#39;t make cgyard subdir&quot;);</div>

</div><div><br></div><div>What do you think?</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>--Saied</div><div><br></div></font></span></div>
</blockquote></div><br></div>