[CRIU] [PATCH 07/13] mounts: share one root for all namespaces

Pavel Emelyanov xemul at parallels.com
Wed Apr 9 05:11:24 PDT 2014


On 04/09/2014 04:13 AM, Andrey Vagin wrote:
> Currently we support nested mount namespaces, only if all of them have
> the same root.
> 
> crtools doesn't mount root, so it should be bind-mounted for all
> namespaces.
> 
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>  mount.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/mount.c b/mount.c
> index 53e4ef6..2fd0cbd 100644
> --- a/mount.c
> +++ b/mount.c
> @@ -242,6 +242,12 @@ static struct mount_info *mnt_build_ids_tree(struct mount_info *list)
>  					m->mnt_id, m->parent_mnt_id, m->mountpoint,
>  					root ? "found" : "not found");
>  			if (root && m->is_root) {
> +				if (!mounts_equal(root, m, true) ||
> +					(strcmp(root->root, m->root))) {
> +					pr_err("Nested mount namespaces with different roots are not supported yet");
> +					return NULL;
> +				}
> +
>  				/*
>  				 * A root of a sub mount namespace is
>  				 * mounted in a temporary directory in the
> @@ -1079,9 +1085,10 @@ static int propagate_mount(struct mount_info *mi)
>  skip_parent:
>  	/*
>  	 * FIXME Currently non-root mounts can be restored
> -	 * only if a proper root mount exists
> +	 * only if a proper root mount exists.
> +	 * Here is one exception for sub-roots. Roots of all mntns are the same.
>  	 */
> -	if (fsroot_mounted(mi))
> +	if (mi->parent == NULL || fsroot_mounted(mi))

This seem to be non-mntns related. This code shows that we don't mount binds
for the root-mount. Why? Can't we fix that separately?

>  		list_for_each_entry(t, &mi->mnt_bind, mnt_bind) {
>  			if (t->bind)
>  				continue;
> 




More information about the CRIU mailing list