[CRIU] [PATCH 20/20] rst: Don't lookup ns if current mntns is the same as root's one
Pavel Emelyanov
xemul at parallels.com
Tue Apr 22 09:40:29 PDT 2014
Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
mount.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/mount.c b/mount.c
index 9ae1762..a38d724 100644
--- a/mount.c
+++ b/mount.c
@@ -1575,13 +1575,10 @@ char *rst_get_mnt_root(int mnt_id)
return path;
}
-static int do_restore_task_mnt_ns(struct ns_id *nsid, pid_t pid)
+static int do_restore_task_mnt_ns(struct ns_id *nsid)
{
char path[PATH_MAX];
- if (root_item->ids->mnt_ns_id == nsid->id)
- return 0;
-
if (nsid->pid != getpid()) {
int fd;
@@ -1616,15 +1613,19 @@ static int do_restore_task_mnt_ns(struct ns_id *nsid, pid_t pid)
int restore_task_mnt_ns(struct pstree_item *current)
{
if (current->ids && current->ids->has_mnt_ns_id) {
+ unsigned int id = current->ids->mnt_ns_id;
struct ns_id *nsid;
- nsid = lookup_ns_by_id(current->ids->mnt_ns_id, &mnt_ns_desc);
+ if (root_item->ids->mnt_ns_id == id)
+ return 0;
+
+ nsid = lookup_ns_by_id(id, &mnt_ns_desc);
if (nsid == NULL) {
- pr_err("Can't find mount namespace %d\n", current->ids->mnt_ns_id);
+ pr_err("Can't find mount namespace %d\n", id);
return -1;
}
- if (do_restore_task_mnt_ns(nsid, current->pid.real))
+ if (do_restore_task_mnt_ns(nsid))
return -1;
}
--
1.7.6.5
More information about the CRIU
mailing list