<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'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 < root_set->n_ctls; i++) {</div><div> ControllerEntry *ce = root_set->ctls[i];</div><div> char *opt = ce->name;</div><div>+ char *cp;</div>
<div>+ int poff = off;</div><div> </div><div> if (strstartswith(ce->name, "name=")) {</div><div>- sprintf(paux + off, "/%s", ce->name + 5);</div>
<div>+ poff += sprintf(paux + off, "/%s", ce->name + 5);</div><div> sprintf(aux, "none,%s", ce->name);</div><div> opt = aux;</div>
<div> } else</div><div>- sprintf(paux + off, "/%s", ce->name);</div><div>+ poff += sprintf(paux + off, "/%s", ce->name);</div><div> </div>
<div> if (mkdir(paux, 0700)) {</div><div> pr_perror("Can't make cgyard subdir");</div><div>@@ -385,6 +387,28 @@ static int prepare_cgroup_sfd(CgSetEntry *root_set)</div>
<div> pr_perror("Can't mount %s cgyard", ce->name);</div><div> goto err;</div><div> }</div><div>+</div><div>+ continue;</div><div>
+</div><div>+ if ((cp = ce->path) == NULL)</div><div>+ continue;</div><div>+</div><div>+ while (*cp) {</div><div>+ while (*cp && *cp == '/') {</div>
<div>+ cp++;</div><div>+ continue;</div><div>+ }</div><div>+ paux[poff] = '/';</div><div>+ while (*cp && *cp != '/') {</div>
<div>+ paux[++poff] = *cp++;</div><div>+ continue;</div><div>+ }</div><div>+ if (paux[poff] != '/') {</div><div>
+ paux[++poff] = '\0';</div><div>+ if (mkdir(paux, 0700) == 0)</div><div>+ pr_info("Created directory %s\n", paux);</div>
<div>+ }</div><div>+ }</div><div> }</div><div> </div><div> pr_debug("Opening %s as cg yard\n", 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>