[Devel] [PATCH] mounts: support only shared NFS mounts in inits mount namespace

Dmitry Safonov dsafonov at virtuozzo.com
Thu Jun 29 15:46:30 MSK 2017


On 06/29/2017 03:14 PM, Stanislav Kinsburskiy wrote:
> The intention of this patch is to define different NFS mount cases and forbid
> most ot them.
> The reason behind this is that the only mount point we can migrate right now
> is:
> 1) created in init mount namespace
> 2) shared (beacuse it's default)
> 
> All the other cases are not supported by spfs manager so far and migration
> attempt can lead to different issues after restore is completed by CRIU.
> 
> https://jira.sw.ru/browse/PSBM-66945
> 
> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
> ---
>   criu/mount.c |   67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
>   1 file changed, 66 insertions(+), 1 deletion(-)

Andrew, could you review it, please?

> 
> diff --git a/criu/mount.c b/criu/mount.c
> index 6916974..3399aa5 100644
> --- a/criu/mount.c
> +++ b/criu/mount.c
> @@ -746,6 +746,70 @@ static bool nfs_mount(const struct mount_info *m)
>   
>   }
>   
> +static char *mnt_mark(const struct mount_info *m)
> +{
> +	static char *shared = "shared";
> +	static char *private = "private";
> +	static char *slave = "slave";
> +
> +	if (m->flags & MS_SHARED)
> +		return shared;
> +
> +	if (m->flags & MS_SLAVE)
> +		return slave;
> +
> +	return private;
> +}
> +
> +static bool unsupported_nfs_mount(const struct mount_info *m)
> +{
> +	const struct mount_info *bm;
> +
> +	switch (m->nsid->type) {
> +		case NS_ROOT:
> +			if (m->flags & MS_SHARED)
> +				return false;
> +
> +			pr_err("NFS mount [%s] in init mount namespace "
> +				"is marked as \"%s\".\n",
> +				m->mountpoint, mnt_mark(m));
> +			pr_err("Only shared NFS mounts in init mount "
> +				"namespace are supported yet.\n");
> +			break;
> +		case NS_OTHER:
> +			if (m->flags & MS_SLAVE) {
> +				list_for_each_entry(bm, &m->mnt_bind, mnt_bind) {
> +					if (unsupported_nfs_mount(bm))
> +						continue;
> +					return false;
> +				}
> +				break;
> +			}
> +
> +			pr_err("NFS mount [%s] in non-init mount namespace "
> +				"is marked as \"%s\".\n",
> +				m->mountpoint, mnt_mark(m));
> +			pr_err("Only slave NFS mounts in non-init mount "
> +				"namespace are supported yet.\n");
> +			break;
> +		case NS_CRIU:
> +			pr_err("NFS mount [%s] in CRIU namespace is "
> +					"unsupported.\n", m->mountpoint);
> +			break;
> +		case NS_UNKNOWN:
> +			pr_err("Unknown NFS mount [%s] namespace type: %d\n",
> +					m->mountpoint, m->nsid->type);
> +			break;
> +		default:
> +			pr_err("Invalid NFS mount [%s] namespace type: %d\n",
> +					m->mountpoint, m->nsid->type);
> +			break;
> +	}
> +
> +
> +	return true;
> +}
> +
>   static bool unsupported_mount(const struct mount_info *m)
>   {
>   	struct mount_info *parent = m->parent;
> @@ -760,7 +824,8 @@ static bool unsupported_mount(const struct mount_info *m)
>   
>   		return true;
>   	}
> -	return false;
> +
> +	return nfs_mount(m) ? unsupported_nfs_mount(m) : false;
>   }
>   
>   static int validate_mounts(struct mount_info *info, bool for_dump)
> 


-- 
              Dmitry


More information about the Devel mailing list