From 776f3cff7ce8e56be908e375b388bd2829de5b9f Mon Sep 17 00:00:00 2001 From: Pavel Tikhomirov Date: Tue, 24 Aug 2021 14:03:08 +0300 Subject: [PATCH] autofs: restore current work directory after restoring mnt ns Else criu would change cwd while dumping autofs mounts. Signed-off-by: Pavel Tikhomirov --- criu/autofs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/criu/autofs.c b/criu/autofs.c index 046d51d48..71edc7bce 100644 --- a/criu/autofs.c +++ b/criu/autofs.c @@ -391,7 +391,7 @@ static int access_autofs_mount(struct mount_info *pm) const char *mnt_path = pm->mountpoint + 1; dev_t dev_id = pm->s_dev; int new_pid_ns = -1, old_pid_ns = -1; - int old_mnt_ns; + int old_mnt_ns, old_cwd_fd; int autofs_mnt; int err = -1; int pid, status; @@ -409,7 +409,7 @@ static int access_autofs_mount(struct mount_info *pm) if (old_pid_ns < 0) goto close_new_pid_ns; - if (switch_ns(pm->nsid->ns_pid, &mnt_ns_desc, &old_mnt_ns)) { + if (switch_mnt_ns(pm->nsid->ns_pid, &old_mnt_ns, &old_cwd_fd)) { pr_err("failed to switch to mount namespace\n"); goto close_old_pid_ns; } @@ -451,7 +451,7 @@ restore_pid_ns: } old_pid_ns = -1; restore_mnt_ns: - if (restore_ns(old_mnt_ns, &mnt_ns_desc)) { + if (restore_mnt_ns(old_mnt_ns, &old_cwd_fd)) { pr_err("failed to restore mount namespace\n"); err = -1; }