mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-29 04:50:26 +00:00
mount: move code to validate shared mounts in a separate function
Signed-off-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
ffe7f01d29
commit
eb214be2d0
1 changed files with 26 additions and 18 deletions
44
mount.c
44
mount.c
|
|
@ -372,6 +372,30 @@ 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)
|
||||||
|
{
|
||||||
|
struct mount_info *ct, *t;
|
||||||
|
|
||||||
|
if (!list_empty(&m->parent->mnt_share))
|
||||||
|
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) {
|
||||||
|
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",
|
||||||
|
t->mnt_id, t->mountpoint,
|
||||||
|
m->mnt_id, m->mountpoint);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int validate_mounts(struct mount_info *info, bool for_dump)
|
static int validate_mounts(struct mount_info *info, bool for_dump)
|
||||||
{
|
{
|
||||||
|
|
@ -382,24 +406,8 @@ static int validate_mounts(struct mount_info *info, bool for_dump)
|
||||||
/* root mount can be any */
|
/* root mount can be any */
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (m->parent->shared_id && !list_empty(&m->parent->mnt_share)) {
|
if (m->parent->shared_id && validate_shared(m))
|
||||||
struct mount_info *ct;
|
return -1;
|
||||||
|
|
||||||
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) {
|
|
||||||
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",
|
|
||||||
t->mnt_id, t->mountpoint,
|
|
||||||
m->mnt_id, m->mountpoint);
|
|
||||||
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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue