<div dir="ltr"><div><div>So I'm adding support for Android binder, which assumes that a process will open the device only once. Based on the existing code flow, the device is opened two times during restore.<br><br></div>I see the following sequence open() -> mmap() -> close() -> open()<br></div>This causes incorrect bookkeeping insider binder driver.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 26, 2015 at 5:25 AM, Pavel Emelyanov <span dir="ltr"><<a href="mailto:xemul@parallels.com" target="_blank">xemul@parallels.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 06/26/2015 09:47 AM, CRIU criu wrote:<br>
> Hi,<br>
><br>
> Does CRIU do multiple open() on a regular file during restore?<br>
<br>
</span>If it's opened and mapped multiple times, then yes. If a file is opened<br>
once and then fd is inherited then open is called once.<br>
<span class=""><br>
> If yes, multiple open() on some device files may lead to incorrect<br>
> bookkeeping inside the kernel driver.<br>
<br>
</span>It depends on the device.<br>
<span class=""><br>
> Please correct me if my understanding is wrong. Thanks!<br>
><br>
> I see the following code being executed:<br>
> prepare_mappings() -> premap_priv_vmas() ->map_private_vma()->get_filemap_fd(vma)<br>
><br>
> This is followed by close(vma-e->fd)<br>
<br>
</span>Yes, this is about mapped files. Right now criu doesn't support for<br>
mapped devices except for /dev/zero, so we're (still) safe here :)<br>
<span class="HOEnZb"><font color="#888888"><br>
-- Pavel<br>
<br>
</font></span></blockquote></div><br></div>