[CRIU] [PATCH 1/2] mount: pick out a function to set ROOT_FD_OFF
Andrey Vagin
avagin at openvz.org
Thu Dec 3 13:13:26 PST 2015
From: Andrew Vagin <avagin at virtuozzo.com>
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
mount.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/mount.c b/mount.c
index 6a9651c..38c9922 100644
--- a/mount.c
+++ b/mount.c
@@ -2920,9 +2920,21 @@ err:
return -1;
}
+static int mntns_root_pid = -1;
+static int mntns_set_root_fd(pid_t pid, int fd)
+{
+ int ret;
+
+ ret = install_service_fd(ROOT_FD_OFF, fd);
+ if (ret >= 0)
+ mntns_root_pid = pid;
+ close(fd);
+
+ return ret;
+}
+
int __mntns_get_root_fd(pid_t pid)
{
- static int mntns_root_pid = -1;
int fd, pfd;
int ret;
@@ -2978,11 +2990,7 @@ int __mntns_get_root_fd(pid_t pid)
}
set_root:
- ret = install_service_fd(ROOT_FD_OFF, fd);
- if (ret >= 0)
- mntns_root_pid = pid;
- close(fd);
- return ret;
+ return mntns_set_root_fd(pid, fd);
}
int mntns_get_root_fd(struct ns_id *mntns) {
--
2.4.3
More information about the CRIU
mailing list