[CRIU] multiple open() on a file during restore

Pavel Emelyanov xemul at parallels.com
Fri Jun 26 05:25:22 PDT 2015


On 06/26/2015 09:47 AM, CRIU criu wrote:
> Hi,
> 
> Does CRIU do multiple open() on a regular file during restore?

If it's opened and mapped multiple times, then yes. If a file is opened
once and then fd is inherited then open is called once.

> If yes, multiple open() on some device files may lead to incorrect
> bookkeeping inside the kernel driver.

It depends on the device.
 
> Please correct me if my understanding is wrong. Thanks!
> 
> I see the following code being executed:
> prepare_mappings() -> premap_priv_vmas() ->map_private_vma()->get_filemap_fd(vma) 
> 
> This is followed by close(vma-e->fd)

Yes, this is about mapped files. Right now criu doesn't support for
mapped devices except for /dev/zero, so we're (still) safe here :)

-- Pavel



More information about the CRIU mailing list