mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 14:55:39 +00:00
mount: allow overmount on parent with shared group
In CT, we do: mkdir -p /a/b/c1 mkdir -p /c2 mount --bind /c2 /a/b/c1 mount --rbind /a/b /a And after that container is not dumpable with error: mnt: Unable to handle mounts under 146:./a Just because overmounts with shared parent group are prohibited, but I can't see any problem with enabling them. https://jira.sw.ru/browse/PSBM-69501 Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
This commit is contained in:
committed by
Andrei Vagin
parent
2214568de9
commit
bf1f9c61c1
20
criu/mount.c
20
criu/mount.c
@@ -688,7 +688,7 @@ static int validate_mounts(struct mount_info *info, bool for_dump)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (mnt_is_external(m))
|
if (mnt_is_external(m))
|
||||||
goto skip_fstype;
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mountpoint can point to / of an FS. In that case this FS
|
* Mountpoint can point to / of an FS. In that case this FS
|
||||||
@@ -738,13 +738,6 @@ static int validate_mounts(struct mount_info *info, bool for_dump)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
skip_fstype:
|
|
||||||
if (does_mnt_overmount(m) &&
|
|
||||||
!list_empty(&m->parent->mnt_share)) {
|
|
||||||
pr_err("Unable to handle mounts under %d:%s\n",
|
|
||||||
m->mnt_id, m->mountpoint);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -1685,12 +1678,21 @@ static int propagate_mount(struct mount_info *mi)
|
|||||||
char path[PATH_MAX], *mp;
|
char path[PATH_MAX], *mp;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If a mount from parent's shared group is not yet mounted
|
||||||
|
* it shouldn't have 'sibling' in it - see can_mount_now()
|
||||||
|
*/
|
||||||
|
if (!t->mounted)
|
||||||
|
continue;
|
||||||
|
|
||||||
mp = mnt_get_sibling_path(mi, t, path, sizeof(path));
|
mp = mnt_get_sibling_path(mi, t, path, sizeof(path));
|
||||||
if (mp == NULL)
|
if (mp == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
list_for_each_entry(c, &t->children, siblings) {
|
list_for_each_entry(c, &t->children, siblings) {
|
||||||
if (mounts_equal(mi, c) && !strcmp(mp, c->mountpoint)) {
|
if (mounts_equal(mi, c) && !strcmp(mp, c->mountpoint)) {
|
||||||
|
/* Should not propagate the same mount twice */
|
||||||
|
BUG_ON(c->mounted);
|
||||||
pr_debug("\t\tPropagate %s\n", c->mountpoint);
|
pr_debug("\t\tPropagate %s\n", c->mountpoint);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2287,7 +2289,7 @@ static int try_remap_mount(struct mount_info *m)
|
|||||||
if (!does_mnt_overmount(m))
|
if (!does_mnt_overmount(m))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
BUG_ON(!m->parent || !list_empty(&m->parent->mnt_share));
|
BUG_ON(!m->parent);
|
||||||
|
|
||||||
r = xmalloc(sizeof(struct mnt_remap_entry));
|
r = xmalloc(sizeof(struct mnt_remap_entry));
|
||||||
if (!r)
|
if (!r)
|
||||||
|
Reference in New Issue
Block a user