<div dir="ltr">Hi,<div><br></div><div>the patch looks good. It avoids using &#39;pread&#39; which is not supported for remote images.</div><div><br></div><div>However, the patch that I sent for the mailing list introducing remote images used &#39;read&#39; instead of &#39;pread&#39;. </div><div><br></div><div>If more code locations were reverted to &#39;pread&#39;, it might be necessary to protect them as well.</div><div><br></div><div>Is there any reason for using &#39;pread&#39; instead of &#39;read&#39;? It seems to me that the code always reads files forwards. </div><div>Additionally, I also made some experiments (including zdtm tests) back in February using &#39;read&#39; instead of &#39;pread&#39; and it worked.</div><div><br></div><div>Best,</div><div>rodrigo</div><div><br><div><div class="gmail_extra"><br><div class="gmail_quote">2017-04-22 4:42 GMT+01:00 Andrei Vagin <span dir="ltr">&lt;<a href="mailto:avagin@virtuozzo.com" target="_blank">avagin@virtuozzo.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Rodrigo, could you review this patch?<br>
<br>
On Fri, Apr 21, 2017 at 06:25:54PM +0300, Mike Rapoport wrote:<br>
&gt; When --remote option is specified, read_local_page tries to pread from a<br>
&gt; socket, and fails with &quot;Illegal seek&quot; error.<br>
&gt; Restore single pread call for regular image files case and use read syscall<br>
&gt; instead of pread for the --remote case.<br>
&gt;<br>
&gt; Signed-off-by: Mike Rapoport &lt;<a href="mailto:rppt@linux.vnet.ibm.com" target="_blank">rppt@linux.vnet.ibm.com</a>&gt;<br>
&gt; ---<br>
&gt;  criu/pagemap.c | 18 +++++++++++++-----<br>
&gt;  1 file changed, 13 insertions(+), 5 deletions(-)<br>
&gt;<br>
&gt; diff --git a/criu/pagemap.c b/criu/pagemap.c<br>
&gt; index 6c741b4..7d25c6f 100644<br>
&gt; --- a/criu/pagemap.c<br>
&gt; +++ b/criu/pagemap.c<br>
&gt; @@ -265,15 +265,23 @@ static int read_local_page(struct page_read *pr, unsigned long vaddr,<br>
&gt;               return -1;<br>
&gt;<br>
&gt;       pr_debug(&quot;\tpr%d-%u Read page from self %lx/%&quot;PRIx64&quot;\n&quot;, pr-&gt;pid, pr-&gt;id, pr-&gt;cvaddr, pr-&gt;pi_off);<br>
&gt; -     while (1) {<br>
&gt; +     if (!opts.remote) {<br>
&gt;               ret = pread(fd, buf + curr, len - curr, pr-&gt;pi_off + curr);<br>
&gt; -             if (ret &lt; 1) {<br>
&gt; +             if (ret != len) {<br>
&gt;                       pr_perror(&quot;Can&#39;t read mapping page %d&quot;, ret);<br>
&gt;                       return -1;<br>
&gt;               }<br>
&gt; -             curr += ret;<br>
&gt; -             if (curr == len)<br>
&gt; -                     break;<br>
&gt; +     } else {<br>
&gt; +             while (1) {<br>
&gt; +                     ret = read(fd, buf + curr, len - curr);<br>
&gt; +                     if (ret &lt; 0) {<br>
&gt; +                             pr_perror(&quot;Can&#39;t read mapping page %d&quot;, ret);<br>
&gt; +                             return -1;<br>
&gt; +                     }<br>
&gt; +                     curr += ret;<br>
&gt; +                     if (curr == len)<br>
&gt; +                             break;<br>
&gt; +             }<br>
&gt;       }<br>
&gt;<br>
&gt;       if (opts.auto_dedup) {<br>
<span class="gmail-m_7209670845697349871m_8986669502199782117HOEnZb"><font color="#888888">&gt; --<br>
&gt; 1.9.1<br>
&gt;<br>
</font></span></blockquote></div><br></div></div></div></div>