mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-29 04:50:26 +00:00
mount: don't open the same root twise
Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
2f4be997b6
commit
37924895b5
1 changed files with 7 additions and 0 deletions
7
mount.c
7
mount.c
|
|
@ -1776,10 +1776,15 @@ out:
|
|||
|
||||
int mntns_collect_root(pid_t pid)
|
||||
{
|
||||
static int mntns_root_pid = -1;
|
||||
|
||||
int fd, pfd;
|
||||
int ret;
|
||||
char path[PATH_MAX + 1];
|
||||
|
||||
if (mntns_root_pid == pid) /* The required root is already opened */
|
||||
return get_service_fd(ROOT_FD_OFF);
|
||||
|
||||
close_service_fd(ROOT_FD_OFF);
|
||||
|
||||
if (!(root_ns_mask & CLONE_NEWNS)) {
|
||||
|
|
@ -1828,6 +1833,8 @@ int mntns_collect_root(pid_t pid)
|
|||
|
||||
set_root:
|
||||
ret = install_service_fd(ROOT_FD_OFF, fd);
|
||||
if (ret >= 0)
|
||||
mntns_root_pid = pid;
|
||||
close(fd);
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue