[CRIU] [PATCH] mnt: Helper and comment for shared mounts validation

Andrew Vagin avagin at parallels.com
Fri Oct 31 03:58:08 PDT 2014


I don't like this patch, because my patches change the same code.
And they rework this code completely.

On Fri, Oct 31, 2014 at 01:50:45PM +0400, Pavel Emelyanov wrote:
> Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
> ---
>  mount.c | 27 +++++++++++++++++++++------
>  1 file changed, 21 insertions(+), 6 deletions(-)
> 
> diff --git a/mount.c b/mount.c
> index f62fd04..f8afc63 100644
> --- a/mount.c
> +++ b/mount.c
> @@ -372,6 +372,25 @@ static int try_resolve_ext_mount(struct mount_info *info)
>  	info->external = em;
>  	return 0;
>  }
> +
> +static struct mount_info *find_shared_peer_for(struct mount_info *m, struct mount_info *at)
> +{
> +	struct mount_info *s;
> +
> +	list_for_each_entry(s, &at->children, siblings)
> +		if (mounts_equal(m, s, false))
> +			return s;
> +
> +	return NULL;
> +}
> +
> +/*
> + * Children set of shared mounts should concide.
> + * We check each mount with its next peer only,
> + * thus any set of shared mounts will be checked
> + * on-by-one.
> + */
> +
>  static int validate_shared(struct mount_info *m)
>  {
>  	struct mount_info *ct, *t;
> @@ -380,12 +399,8 @@ static int validate_shared(struct mount_info *m)
>  		return 0;
>  
>  	t = list_first_entry(&m->parent->mnt_share, struct mount_info, mnt_share);
> -
> -	list_for_each_entry(ct, &t->children, siblings) {
> -		if (mounts_equal(m, ct, false))
> -			break;
> -	}
> -	if (&ct->siblings == &t->children) {
> +	ct = find_shared_peer_for(m, t);
> +	if (!ct) {
>  		pr_err("Two shared mounts %d, %d have different sets of children\n",
>  			m->parent->mnt_id, t->mnt_id);
>  		pr_err("%d:%s doesn't have a proper point for %d:%s\n",
> -- 
> 1.8.4.2
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list