[CRIU] [PATCH] mount: Fix cleanup_mnt_ns() when opts.root is set

Andrei Vagin avagin at gmail.com
Sun Jan 13 08:30:26 MSK 2019


Applied, thanks. Good catch!

On Fri, Jan 11, 2019 at 12:23:52PM +0000, Radostin Stoyanov wrote:
> In commit
> 
>     c1404f66712e7bacd7cbc7cef1bb85c7c6ad698f
>     mount: restore cwd after creating a roots yard (v2)
> 
> were introduced changes to the function cleanup_mnt_ns() that handle
> the case when opts.root is set.
> 
> However, after commit
> 
>     2e8970beda5bfb7d56fd3351ae57d8dd1c69b2c7
>     mount: create a mount point for the root mount namespace in the roots yard
> 
> the cleanup_mnt_ns() function always results in error:
> 
>     mnt: Can't remove the directory ...: No such file or directory
> 
> when restore fails and opts.root has been set.
> 
> Resolves #467
> 
> Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
> ---
>  criu/mount.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/criu/mount.c b/criu/mount.c
> index f578c7b6a..55c264a9c 100644
> --- a/criu/mount.c
> +++ b/criu/mount.c
> @@ -3263,13 +3263,7 @@ int depopulate_roots_yard(int mntns_fd, bool only_ghosts)
>  
>  void cleanup_mnt_ns(void)
>  {
> -	char path[PATH_MAX], *root = opts.root ? : "/";
> -
> -	if (mnt_roots == NULL)
> -		return;
> -
> -	snprintf(path, sizeof(path), "%s/%s", root, mnt_roots);
> -	if (rmdir(path))
> +	if (rmdir(mnt_roots))
>  		pr_perror("Can't remove the directory %s", mnt_roots);
>  }
>  
> -- 
> 2.20.1
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list