[CRIU] [PATCH] mounts: Skip already bound siblings in propagate_siblings()

Pavel Emelyanov xemul at virtuozzo.com
Fri Feb 12 04:13:23 PST 2016


On 02/10/2016 02:58 PM, Kirill Tkhai wrote:
> This function may be called several times for a mnt_share family.
> The second call with a mi, which was not a bind source during the
> first call, leads to double dependence:
> 
> a <-> b <-> c
> 
> 1)propagate_siblings(a)
> 
> b->bind = a;
> c->bind = a;
> 
> 2)propagate_siblings(b)
> 
> c->bind = b;
> (a is not set, because its mounted is 1).
> 
> So during c's bind mount criu use b's root and refers to a wrong
> directory.
> 
> The reproduction: mntns_root_bind and bind-mount test together.

Add test to zdtm that fails w/o this patch and passes with it.

> The patch fixes the problem.
> 
> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> ---
>  mount.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mount.c b/mount.c
> index 05cf6cf..bf07133 100644
> --- a/mount.c
> +++ b/mount.c
> @@ -2118,7 +2118,7 @@ static int propagate_siblings(struct mount_info *mi)
>  	 * to inherite shared group or master id
>  	 */
>  	list_for_each_entry(t, &mi->mnt_share, mnt_share) {
> -		if (t->mounted)
> +		if (t->mounted || t->bind)
>  			continue;
>  		pr_debug("\t\tBind share %s\n", t->mountpoint);
>  		t->bind = mi;
> @@ -2126,7 +2126,7 @@ static int propagate_siblings(struct mount_info *mi)
>  	}
>  
>  	list_for_each_entry(t, &mi->mnt_slave_list, mnt_slave) {
> -		if (t->mounted)
> +		if (t->mounted || t->bind)
>  			continue;
>  		pr_debug("\t\tBind slave %s\n", t->mountpoint);
>  		t->bind = mi;
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
> .
> 



More information about the CRIU mailing list