<div dir="ltr">CRIU fails to restore a process running inside a Docker container with the error message:<div><br></div><div><div><div>(00.035110)      1: Error (cgroup.c:278): cg: Can&#39;t move into blkio//docker/2fda692b0fd31c20197b84b8ca5e172679dfaf9028c7322b7bb43acf061626cf/tasks (-1/-1)</div>
</div></div><div><br></div><div>This is because the container subdirectory (i.e., 64-character ID above) is not created under docker.</div><div><br></div><div>I applied the following quick patch as a workaround and was able to successfully restore and resume a process running inside a Docker container.  But the issue requires more study and changes as simply recreating the directories on demand may not be enough.</div>
<div><br></div><div><div>diff --git a/cgroup.c b/cgroup.c</div><div>index 60b560c..538cf17 100644</div><div>--- a/cgroup.c</div><div>+++ b/cgroup.c</div><div>@@ -368,13 +368,15 @@ static int prepare_cgroup_sfd(CgSetEntry *root_set)</div>
<div>        for (i = 0; i &lt; root_set-&gt;n_ctls; i++) {</div><div>                ControllerEntry *ce = root_set-&gt;ctls[i];</div><div>                char *opt = ce-&gt;name;</div><div>+               char *cp;</div>
<div>+               int poff = off;</div><div> </div><div>                if (strstartswith(ce-&gt;name, &quot;name=&quot;)) {</div><div>-                       sprintf(paux + off, &quot;/%s&quot;, ce-&gt;name + 5);</div>
<div>+                       poff += 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>                } else</div><div>-                       sprintf(paux + off, &quot;/%s&quot;, ce-&gt;name);</div><div>+                       poff += 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>@@ -385,6 +387,28 @@ static int prepare_cgroup_sfd(CgSetEntry *root_set)</div>
<div>                        pr_perror(&quot;Can&#39;t mount %s cgyard&quot;, ce-&gt;name);</div><div>                        goto err;</div><div>                }</div><div>+</div><div>+               continue;</div><div>
+</div><div>+               if ((cp = ce-&gt;path) == NULL)</div><div>+                       continue;</div><div>+</div><div>+               while (*cp) {</div><div>+                       while (*cp &amp;&amp; *cp == &#39;/&#39;) {</div>
<div>+                               cp++;</div><div>+                               continue;</div><div>+                       }</div><div>+                       paux[poff] = &#39;/&#39;;</div><div>+                       while (*cp &amp;&amp; *cp != &#39;/&#39;) {</div>
<div>+                               paux[++poff] = *cp++;</div><div>+                               continue;</div><div>+                       }</div><div>+                       if (paux[poff] != &#39;/&#39;) {</div><div>
+                               paux[++poff] = &#39;\0&#39;;</div><div>+                               if (mkdir(paux, 0700) == 0)</div><div>+                                       pr_info(&quot;Created directory %s\n&quot;, paux);</div>
<div>+                       }</div><div>+               }</div><div>        }</div><div> </div><div>        pr_debug(&quot;Opening %s as cg yard\n&quot;, cg_yard);</div></div><div><br></div><div>Please let me know what you think.<br>
</div><div><br></div><div>--Saied</div><div><br></div></div>