[CRIU] [PATCH] mount: use correct mount namespace in open_mountpoint

Andrey Ryabinin aryabinin at virtuozzo.com
Wed Nov 11 07:12:48 PST 2015


open_mountpoint() have to operate in target's mount namespace,
which may differ from root's namespace - root_item->pid.real.

So obtain the correct mount namespace from mount_info and use
it in switch_ns().

Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 mount.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mount.c b/mount.c
index aea9807..3fcced5 100644
--- a/mount.c
+++ b/mount.c
@@ -1085,7 +1085,7 @@ static int open_mountpoint(struct mount_info *pm)
 		return -1;
 	}
 
-	if (switch_ns(root_item->pid.real, &mnt_ns_desc, &ns_old) < 0)
+	if (switch_ns(pm->nsid->ns_pid, &mnt_ns_desc, &ns_old) < 0)
 		goto out;
 
 	mnt_path = mkdtemp(mnt_path_tmp);
-- 
2.4.10



More information about the CRIU mailing list