[CRIU] [PATCH 1/2] mount: validate mounts only once on dump
Pavel Emelyanov
xemul at parallels.com
Wed Sep 10 07:32:01 PDT 2014
On 09/10/2014 04:46 PM, Andrey Vagin wrote:
> mntinfo contains mounts from all namespaces, so we can validate it only
> once after collecting mounts.
>
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
> mount.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/mount.c b/mount.c
> index 001aa45..585375c 100644
> --- a/mount.c
> +++ b/mount.c
> @@ -993,9 +993,6 @@ static int dump_mnt_ns(struct ns_id *ns, struct mount_info *pms)
> int img_fd = -1, ret = -1;
> int ns_id = ns->id;
>
> - if (validate_mounts(pms, true))
> - goto err;
> -
> pr_info("Dumping mountpoints\n");
> img_fd = open_image(CR_FD_MNTS, O_DUMP, ns_id);
> if (img_fd < 0)
> @@ -2096,8 +2093,8 @@ static int walk_mnt_ns(int (*cb)(struct ns_id *, struct mount_info *, void *), v
> if (mntinfo == NULL)
> goto err;
> }
> -
> - continue;
> + /* We are not going to dump this tree, so we skip validation */
> + goto out;
Are you sure this goto should be here? What if we collected other
namespaces, shouldn't we validate them?
> }
>
> pr_info("Dump MNT namespace (mountpoints) %d via %d\n", ns->id, ns->pid);
> @@ -2112,6 +2109,9 @@ static int walk_mnt_ns(int (*cb)(struct ns_id *, struct mount_info *, void *), v
> }
> if (collect_shared(mntinfo))
> goto err;
> + if (validate_mounts(mntinfo, true))
> + goto err;
> +out:
> ret = 0;
> err:
> return ret;
>
More information about the CRIU
mailing list