[CRIU] [PATCH] mount: restore cwd after creating a roots yard
Pavel Emelyanov
xemul at parallels.com
Fri Dec 4 01:32:54 PST 2015
On 12/03/2015 10:58 PM, Andrey Vagin wrote:
> From: Andrew Vagin <avagin at virtuozzo.com>
>
> Currently we see that a cgroup yard are not umounted
> with the ENOENT error, because cwd was changed.
>
> Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
> @@ -2756,11 +2772,21 @@ int depopulate_roots_yard(void)
>
> void cleanup_mnt_ns(void)
> {
> + char path[PATH_MAX], *root = opts.root ? : "/";
> + int fd;
> +
> if (mnt_roots == NULL)
> return;
>
> - if (rmdir(mnt_roots))
> + fd = open(root, O_DIRECTORY | O_RDONLY);
> + if (fd < 0) {
> + pr_perror("Unable to open %s", opts.root);
> + return;
> + }
> + snprintf(path, sizeof(path), "/proc/self/fd/%d/%s", fd, mnt_roots);
> + if (rmdir(path))
> pr_perror("Can't remove the directory %s", mnt_roots);
> + close(fd);
This hunk doesn't fit the patch description. What does it do?
> }
>
> int prepare_mnt_ns(void)
>
More information about the CRIU
mailing list