[CRIU] [PATCH 3/4] mount: Handle deleted bindmounts

Andrew Vagin avagin at gmail.com
Wed Aug 26 04:30:52 PDT 2015


On Mon, Aug 17, 2015 at 11:09:48PM +0300, Cyrill Gorcunov wrote:
> @@ -1990,11 +1994,25 @@ static int do_bind_mount(struct mount_info *mi)
>  		root = rpath;
>  do_bind:
>  		pr_info("\tBind %s to %s\n", root, mi->mountpoint);
> -		if (mount(root, mi->mountpoint, NULL,
> -					MS_BIND, NULL) < 0) {
> +
> +		if (unlikely(mi->deleted)) {
> +			if (mkdir(root, 0700)) {

https://github.com/xemul/criu/issues/9
In this issue a file was bind-mounted. Can we handle this case?

> +				pr_perror("Can't re-create deleted %s\n", root);
> +				return -1;
> +			}
> +		}
> +
> +		if (mount(root, mi->mountpoint, NULL, MS_BIND, NULL) < 0) {
>  			pr_perror("Can't mount at %s", mi->mountpoint);
>  			return -1;
>  		}
> +
> +		if (unlikely(mi->deleted)) {
> +			if (rmdir(root)) {
> +				pr_perror("Can't remove deleted %s\n", root);
> +				return -1;
> +			}
> +		}


More information about the CRIU mailing list