[v4,04/19] mnt: Remove useless closes in __mntns_get_root_fd()

Submitted by Kirill Tkhai on Jan. 10, 2018, 2 p.m.

Details

Message ID 151559285720.31108.1039765995538695333.stgit@localhost.localdomain
State Accepted
Series "Introduce custom per-task service fds placement"
Commit ef8ea19010045cb78da64aebc91124f019e96130
Headers show

Commit Message

Kirill Tkhai Jan. 10, 2018, 2 p.m.
1)Further mntns_set_root_fd() calls install_service_fd(),
which silently closes already open fd. So, kill close_service_fd()
and make __mntns_get_root_fd() atomical in ROOT_FD_OFF modifications.

2)close_pid_proc() is not need here, as it's about root_item's
/proc directory and __mntns_get_root_fd() actions don't act on it.

v4: New

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 criu/mount.c |    3 ---
 1 file changed, 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/mount.c b/criu/mount.c
index a6e6f180b..aac5c0033 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -3314,8 +3314,6 @@  int __mntns_get_root_fd(pid_t pid)
 	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)) {
 		/*
 		 * If criu and tasks we dump live in the same mount
@@ -3354,7 +3352,6 @@  int __mntns_get_root_fd(pid_t pid)
 	}
 
 	fd = openat(pfd, "root", O_RDONLY | O_DIRECTORY, 0);
-	close_pid_proc();
 	if (fd < 0) {
 		pr_perror("Can't open the task root");
 		return -1;