<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Found another problem, if I patch your test with these diff just adding one extra directory it does not restore again:</div><div><br></div><div>diff --git a/test/zdtm/static/unlink_dir.c b/test/zdtm/static/unlink_dir.c<br>index 1d9a19bc4..48015e9de 100644<br>--- a/test/zdtm/static/unlink_dir.c<br>+++ b/test/zdtm/static/unlink_dir.c<br>@@ -19,9 +19,10 @@ TEST_OPTION(dirname, string, "directory name", 1);<br> <br> int main(int argc, char ** argv)<br> {<br>- int fds[4], dirfd1, dirfd2, i, len;<br>+ int fds[4], dirfd1, dirfd3, i, len;<br> char path_dir1[PATH_MAX];<br> char path_dir2[PATH_MAX];<br>+ char path_dir3[PATH_MAX];<br> char path[PATH_MAX];<br> <br> int lo = ARRAY_SIZE(fds) / 2;<br>@@ -48,6 +49,13 @@ int main(int argc, char ** argv)<br> return 1;<br> }<br> <br>+ len = snprintf(path_dir3, sizeof(path_dir3), "%s/%s/%s/%s", dirname, "gd1", "gd2", "gd3");<br>+ if (len == sizeof(path_dir3)) path_dir3[len-1] = '\0';<br>+ if (mkdir(path_dir3, 0700) < 0) {<br>+ pr_perror("Can't create directory %s", path_dir3);<br>+ return 1;<br>+ }<br>+<br> for (i = 0; i < lo; i++) {<br> len = snprintf(path, sizeof(path), "%s/%d", path_dir1, i);<br> if (len == sizeof(path)) path[len-1] = '\0';<br>@@ -62,8 +70,8 @@ int main(int argc, char ** argv)<br> }<br> }<br> <br>- dirfd2 = open(path_dir2, O_RDONLY | O_DIRECTORY);<br>- if (dirfd2 < 0) {<br>+ dirfd3 = open(path_dir3, O_RDONLY | O_DIRECTORY);<br>+ if (dirfd3 < 0) {<br> pr_perror("Can't open %s", path_dir2);<br> return 1;<br> }<br>@@ -88,6 +96,11 @@ int main(int argc, char ** argv)<br> return 1;<br> }<br> <br>+ if (rmdir(path_dir3)) {<br>+ pr_perror("Can't rmdir %s", path_dir3);<br>+ return 1;<br>+ }<br>+<br> if (rmdir(path_dir2)) {<br> pr_perror("Can't rmdir %s", path_dir2);<br> return 1;<br></div><div><br></div><div>I get:</div><div><br></div><div>[root@snorch criu]# ./test/zdtm.py run -t zdtm/static/unlink_dir<br>=== Run 1/1 ================ zdtm/static/unlink_dir<br>======================= Run zdtm/static/unlink_dir in h ========================<br>Start test<br>./unlink_dir --pidfile=unlink_dir.pid --outfile=unlink_dir.out --dirname=unlink_dir.test<br>Run criu dump<br>Run criu restore<br>=[log]=> dump/zdtm/static/unlink_dir/36/1/restore.log<br>------------------------ grep Error ------------------------<br>(00.004058) Unlink remap home/snorch/devel/criu/test/zdtm/static/unlink_dir.test/gd1/gd2/2.cr.4.ghost<br>(00.004073) Unlink remap home/snorch/devel/criu/test/zdtm/static/unlink_dir.test/gd1/gd2/3.cr.5.ghost<br>(00.004084) Unlink remap home/snorch/devel/criu/test/zdtm/static/unlink_dir.test/gd1/gd2/gd3<br>(00.004100) Unlink remap home/snorch/devel/criu/test/zdtm/static/unlink_dir.test/gd1<br>(00.004123) Error (criu/files-reg.c:792): Couldn't unlink remap / home/snorch/devel/criu/test/zdtm/static/unlink_dir.test/gd1: Directory not empty<br>(00.004146) Unlink remap home/snorch/devel/criu/test/zdtm/static/unlink_dir.test/gd1<br>(00.004156) Error (criu/files-reg.c:792): Couldn't unlink remap / home/snorch/devel/criu/test/zdtm/static/unlink_dir.test/gd1: Directory not empty<br>(00.004162) Error (criu/cr-restore.c:2294): Restoring FAILED.<br>------------------------ ERROR OVER ------------------------<br>############### Test zdtm/static/unlink_dir FAIL at CRIU restore ###############<br>##################################### FAIL #####################################<br></div><div><div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><br>Best Regards, Tikhomirov Pavel.</div></div></div><br></div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">пт, 8 февр. 2019 г. в 15:08, Cyrill Gorcunov <<a href="mailto:gorcunov@gmail.com">gorcunov@gmail.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Fri, Feb 08, 2019 at 01:24:27PM +0300, Pavel Tikhomirov wrote:<br>
> > check error like: if (len >= sizeof(path_dir1)) return -1;<br>
> <br>
> It is for warnings suppression nothing else. Strictly speaking we might<br>
> need to check for negative value rather but since it is path-max limit<br>
> i don't expect here any errors at all, just to placate gcc.<br>
> <br>
> FMPOV actual overflow check is better here, it is what gcc really wants<br>
> from us by these warnings.<br>
> Except that, Reviewed-by: Pavel Tikhomirov <<a href="mailto:ptikhomirov@virtuozzo.com" target="_blank">ptikhomirov@virtuozzo.com</a>><br>
<br>
I don't mind. Will update.<br>
</blockquote></div>