Commit eb214be2 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

mount: move code to validate shared mounts in a separate function

Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ffe7f01d
...@@ -372,18 +372,12 @@ static int try_resolve_ext_mount(struct mount_info *info) ...@@ -372,18 +372,12 @@ static int try_resolve_ext_mount(struct mount_info *info)
info->external = em; info->external = em;
return 0; return 0;
} }
static int validate_shared(struct mount_info *m)
static int validate_mounts(struct mount_info *info, bool for_dump)
{ {
struct mount_info *m, *t; struct mount_info *ct, *t;
for (m = info; m; m = m->next) {
if (m->parent == NULL || m->is_ns_root)
/* root mount can be any */
continue;
if (m->parent->shared_id && !list_empty(&m->parent->mnt_share)) { if (!list_empty(&m->parent->mnt_share))
struct mount_info *ct; return 0;
t = list_first_entry(&m->parent->mnt_share, struct mount_info, mnt_share); t = list_first_entry(&m->parent->mnt_share, struct mount_info, mnt_share);
...@@ -399,7 +393,21 @@ static int validate_mounts(struct mount_info *info, bool for_dump) ...@@ -399,7 +393,21 @@ static int validate_mounts(struct mount_info *info, bool for_dump)
m->mnt_id, m->mountpoint); m->mnt_id, m->mountpoint);
return -1; return -1;
} }
}
return 0;
}
static int validate_mounts(struct mount_info *info, bool for_dump)
{
struct mount_info *m, *t;
for (m = info; m; m = m->next) {
if (m->parent == NULL || m->is_ns_root)
/* root mount can be any */
continue;
if (m->parent->shared_id && validate_shared(m))
return -1;
/* /*
* Mountpoint can point to / of an FS. In that case this FS * Mountpoint can point to / of an FS. In that case this FS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment