2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +00:00

Workaround for the OverlayFS bug present before Kernel 4.2

This is here only to support the Linux Kernel between versions
3.18 and 4.2. After that, this workaround is not needed anymore,
but it will work properly on both a kernel with and without the bug.

The bug is that when a process has a file open in an OverlayFS directory,
the information in /proc/<pid>/fd/<fd> and /proc/<pid>/fdinfo/<fd>
is wrong, so we grab that information from the mountinfo table instead.

This is done every time fill_fdlink is called.
We first check to see if the mnt_id and st_dev numbers currently match
some entry in the mountinfo table. If so, we already have the correct mnt_id
and no fixup is needed.

Then we proceed to see if there are any overlayFS mounted directories
in the mountinfo table. If so, we concatenate the mountpoint with the
name of the file, and stat the resulting path to check if we found the
correct device id and node number. If that is the case, we update the
mount id and link variables with the correct values.

Signed-off-by: Gabriel Guimaraes <gabriellimaguimaraes@gmail.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Gabriel Guimaraes
2015-07-24 21:15:28 +00:00
committed by Pavel Emelyanov
parent b9b0730cb1
commit dbaab31f31
7 changed files with 162 additions and 0 deletions

View File

@@ -2057,6 +2057,19 @@ out:
return exit_code;
}
/*
* If an OverlayFS mountpoint is found in the mountinfo table,
* we enable opts.overlayfs, which is a workaround for the
* OverlayFS Kernel bug.
*
* See fixup_overlayfs for details.
*/
int overlayfs_parse(struct mount_info *new)
{
opts.overlayfs = true;
return 0;
}
/*
* AUFS callback function to "fix up" the root pathname.
* See sysfs_parse.c for details.