[CRIU] [PATCH 1/6] mnt: add a function to check whether a mount overmounts something
Pavel Emelyanov
xemul at virtuozzo.com
Wed Sep 21 00:18:26 PDT 2016
On 09/13/2016 07:19 AM, Andrei Vagin wrote:
> From: Andrei Vagin <avagin at virtuozzo.com>
>
> This function is going to be used more than once.
>
> Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
> ---
> criu/mount.c | 28 +++++++++++++++++++++-------
> 1 file changed, 21 insertions(+), 7 deletions(-)
>
> diff --git a/criu/mount.c b/criu/mount.c
> index fe120a1..797edd7 100644
> --- a/criu/mount.c
> +++ b/criu/mount.c
> @@ -637,6 +637,23 @@ static struct mount_info *find_fsroot_mount_for(struct mount_info *bm)
> return NULL;
> }
>
> +static bool does_mnt_overmount(struct mount_info *m)
> +{
> + struct mount_info *t;
> +
> + if (!m->parent)
> + return false;
> +
> + list_for_each_entry(t, &m->parent->children, siblings) {
> + if (m == t)
> + continue;
> + if (issubpath(t->mountpoint, m->mountpoint))
> + return true;
> + }
> +
> + return false;
> +}
> +
> static int validate_mounts(struct mount_info *info, bool for_dump)
> {
> struct mount_info *m, *t;
> @@ -701,13 +718,10 @@ static int validate_mounts(struct mount_info *info, bool for_dump)
> }
> }
> skip_fstype:
> - list_for_each_entry(t, &m->parent->children, siblings) {
> - if (m == t)
> - continue;
> - if (!issubpath(m->mountpoint, t->mountpoint))
> - continue;
> -
> - pr_err("%d:%s is overmounted\n", m->mnt_id, m->mountpoint);
> + if (does_mnt_overmount(m) &&
> + !list_empty(&m->parent->mnt_share)) {
This check is new (for mnt_share list). Why is it here?
> + pr_err("Unable to handle mounts under %d:%s\n",
> + m->mnt_id, m->mountpoint);
> return -1;
> }
> }
>
More information about the CRIU
mailing list