<div dir="ltr">The bottom of this patch removes crfail flag from existing zdtm test:<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span style="font-size:12.8px">diff --git a/test/zdtm/static/unlink_</span><wbr style="font-size:12.8px"><span style="font-size:12.8px">regular00.desc b/test/zdtm/static/unlink_</span><wbr style="font-size:12.8px"><span style="font-size:12.8px">regular00.desc</span><br style="font-size:12.8px"><span style="font-size:12.8px">index 14d4c06..cd3aa9d 100644</span><br style="font-size:12.8px"><span style="font-size:12.8px">--- a/test/zdtm/static/unlink_</span><wbr style="font-size:12.8px"><span style="font-size:12.8px">regular00.desc</span><br style="font-size:12.8px"><span style="font-size:12.8px">+++ b/test/zdtm/static/unlink_</span><wbr style="font-size:12.8px"><span style="font-size:12.8px">regular00.desc</span><br style="font-size:12.8px"><span style="font-size:12.8px">@@ -1 +1 @@</span><br style="font-size:12.8px"><span style="font-size:12.8px">-{'flavor': 'ns', 'flags': 'suid crfail', 'opts': '--link-remap'}</span><br style="font-size:12.8px"><span style="font-size:12.8px">+{'flavor': 'ns', 'flags': 'suid', 'opts': '--link-remap'}</span></blockquote><div><br></div><div>Do you think that we need more tests for this error?</div><div> </div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-08-10 16:33 GMT+03:00 Pavel Emelyanov <span dir="ltr"><<a href="mailto:xemul@virtuozzo.com" target="_blank">xemul@virtuozzo.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 08/09/2016 04:15 PM, Egor Gorbunov wrote:<br>
> Currently during criu dump we create link remap in the same dir<br>
> where original file was opened. But that dir may not exist during<br>
> link remap creation. At the same time it's okay to create link<br>
> remap in any dir on the same mount point.<br>
> In this patch we do this. We check existance of every dir bottom<br>
> up through the original file path. We use the first existing dir.<br>
><br>
> Similar approach is used on criu restore during ghost file creation.<br>
<br>
</span>OK. Can you also cook a zdtm test that triggers this error?<br>
<div class="HOEnZb"><div class="h5"><br>
> Signed-off-by: Egor Gorbunov <<a href="mailto:egor-mailbox@ya.ru">egor-mailbox@ya.ru</a>><br>
> Signed-off-by: Eugene Batalov <<a href="mailto:eabatalov89@gmail.com">eabatalov89@gmail.com</a>><br>
> ---<br>
> criu/files-reg.c | 12 +++++++++++-<br>
> test/zdtm/static/unlink_<wbr>regular00.desc | 2 +-<br>
> 2 files changed, 12 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/criu/files-reg.c b/criu/files-reg.c<br>
> index 2b7a211..29b48fe 100644<br>
> --- a/criu/files-reg.c<br>
> +++ b/criu/files-reg.c<br>
> @@ -718,6 +718,7 @@ static int create_link_remap(char *path, int len, int lfd,<br>
> RegFileEntry rfe = REG_FILE_ENTRY__INIT;<br>
> FownEntry fwn = FOWN_ENTRY__INIT;<br>
> int mntns_root;<br>
> + int ret;<br>
><br>
> if (!opts.link_remap_ok) {<br>
> pr_err("Can't create link remap for %s. "<br>
> @@ -754,7 +755,16 @@ static int create_link_remap(char *path, int len, int lfd,<br>
><br>
> mntns_root = mntns_get_root_fd(nsid);<br>
><br>
> - if (linkat(lfd, "", mntns_root, link_name, AT_EMPTY_PATH) < 0) {<br>
> +again:<br>
> + ret = linkat(lfd, "", mntns_root, link_name, AT_EMPTY_PATH);<br>
> + if (ret < 0 && errno == ENOENT) {<br>
> + /* Use grand parent, if parent directory does not exist. */<br>
> + if (trim_last_parent(link_name) < 0) {<br>
> + pr_err("trim failed: @%s@\n", link_name);<br>
> + return -1;<br>
> + }<br>
> + goto again;<br>
> + } else if (ret < 0) {<br>
> pr_perror("Can't link remap to %s", path);<br>
> return -1;<br>
> }<br>
> diff --git a/test/zdtm/static/unlink_<wbr>regular00.desc b/test/zdtm/static/unlink_<wbr>regular00.desc<br>
> index 14d4c06..cd3aa9d 100644<br>
> --- a/test/zdtm/static/unlink_<wbr>regular00.desc<br>
> +++ b/test/zdtm/static/unlink_<wbr>regular00.desc<br>
> @@ -1 +1 @@<br>
> -{'flavor': 'ns', 'flags': 'suid crfail', 'opts': '--link-remap'}<br>
> +{'flavor': 'ns', 'flags': 'suid', 'opts': '--link-remap'}<br>
><br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Best regards,<br>Eugene Batalov.</div>
</div>