<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">-{&#39;flavor&#39;: &#39;ns&#39;, &#39;flags&#39;: &#39;suid crfail&#39;, &#39;opts&#39;: &#39;--link-remap&#39;}</span><br style="font-size:12.8px"><span style="font-size:12.8px">+{&#39;flavor&#39;: &#39;ns&#39;, &#39;flags&#39;: &#39;suid&#39;, &#39;opts&#39;: &#39;--link-remap&#39;}</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">&lt;<a href="mailto:xemul@virtuozzo.com" target="_blank">xemul@virtuozzo.com</a>&gt;</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>
&gt; Currently during criu dump we create link remap in the same dir<br>
&gt; where original file was opened. But that dir may not exist during<br>
&gt; link remap creation. At the same time it&#39;s okay to create link<br>
&gt; remap in any dir on the same mount point.<br>
&gt; In this patch we do this. We check existance of every dir bottom<br>
&gt; up through the original file path. We use the first existing dir.<br>
&gt;<br>
&gt; 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>
&gt; Signed-off-by: Egor Gorbunov &lt;<a href="mailto:egor-mailbox@ya.ru">egor-mailbox@ya.ru</a>&gt;<br>
&gt; Signed-off-by: Eugene Batalov &lt;<a href="mailto:eabatalov89@gmail.com">eabatalov89@gmail.com</a>&gt;<br>
&gt; ---<br>
&gt;  criu/files-reg.c                       | 12 +++++++++++-<br>
&gt;  test/zdtm/static/unlink_<wbr>regular00.desc |  2 +-<br>
&gt;  2 files changed, 12 insertions(+), 2 deletions(-)<br>
&gt;<br>
&gt; diff --git a/criu/files-reg.c b/criu/files-reg.c<br>
&gt; index 2b7a211..29b48fe 100644<br>
&gt; --- a/criu/files-reg.c<br>
&gt; +++ b/criu/files-reg.c<br>
&gt; @@ -718,6 +718,7 @@ static int create_link_remap(char *path, int len, int lfd,<br>
&gt;       RegFileEntry rfe = REG_FILE_ENTRY__INIT;<br>
&gt;       FownEntry fwn = FOWN_ENTRY__INIT;<br>
&gt;       int mntns_root;<br>
&gt; +     int ret;<br>
&gt;<br>
&gt;       if (!opts.link_remap_ok) {<br>
&gt;               pr_err(&quot;Can&#39;t create link remap for %s. &quot;<br>
&gt; @@ -754,7 +755,16 @@ static int create_link_remap(char *path, int len, int lfd,<br>
&gt;<br>
&gt;       mntns_root = mntns_get_root_fd(nsid);<br>
&gt;<br>
&gt; -     if (linkat(lfd, &quot;&quot;, mntns_root, link_name, AT_EMPTY_PATH) &lt; 0) {<br>
&gt; +again:<br>
&gt; +     ret = linkat(lfd, &quot;&quot;, mntns_root, link_name, AT_EMPTY_PATH);<br>
&gt; +     if (ret &lt; 0 &amp;&amp; errno == ENOENT) {<br>
&gt; +             /* Use grand parent, if parent directory does not exist. */<br>
&gt; +             if (trim_last_parent(link_name) &lt; 0) {<br>
&gt; +                     pr_err(&quot;trim failed: @%s@\n&quot;, link_name);<br>
&gt; +                     return -1;<br>
&gt; +             }<br>
&gt; +             goto again;<br>
&gt; +     } else if (ret &lt; 0) {<br>
&gt;               pr_perror(&quot;Can&#39;t link remap to %s&quot;, path);<br>
&gt;               return -1;<br>
&gt;       }<br>
&gt; diff --git a/test/zdtm/static/unlink_<wbr>regular00.desc b/test/zdtm/static/unlink_<wbr>regular00.desc<br>
&gt; index 14d4c06..cd3aa9d 100644<br>
&gt; --- a/test/zdtm/static/unlink_<wbr>regular00.desc<br>
&gt; +++ b/test/zdtm/static/unlink_<wbr>regular00.desc<br>
&gt; @@ -1 +1 @@<br>
&gt; -{&#39;flavor&#39;: &#39;ns&#39;, &#39;flags&#39;: &#39;suid crfail&#39;, &#39;opts&#39;: &#39;--link-remap&#39;}<br>
&gt; +{&#39;flavor&#39;: &#39;ns&#39;, &#39;flags&#39;: &#39;suid&#39;, &#39;opts&#39;: &#39;--link-remap&#39;}<br>
&gt;<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>