mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 01:51:51 +00:00
mount: restore root mount flags
Mount flags belong to mount and mount namespace of the Container, so we should preserve them, as Container user will not expect mounts switching between ro and rw over c/r. Fixes: #2632 v5: fix both mount-v1 and mount-v2 Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
This commit is contained in:
parent
799504d9ff
commit
6a91ad8f71
@ -443,6 +443,7 @@ err:
|
||||
/* Mounts root container mount. */
|
||||
static int do_mount_root_v2(struct mount_info *mi)
|
||||
{
|
||||
unsigned long mflags = mi->flags & (~MS_PROPAGATE);
|
||||
unsigned long flags = MS_BIND;
|
||||
int fd;
|
||||
|
||||
@ -477,6 +478,11 @@ static int do_mount_root_v2(struct mount_info *mi)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (mflags && mount(NULL, mi->plain_mountpoint, NULL, MS_REMOUNT | MS_BIND | mflags, NULL)) {
|
||||
pr_perror("Unable to apply root mount options");
|
||||
return -1;
|
||||
}
|
||||
|
||||
mi->mounted = true;
|
||||
|
||||
return 0;
|
||||
|
@ -2690,9 +2690,16 @@ shared:
|
||||
|
||||
static int do_mount_root(struct mount_info *mi)
|
||||
{
|
||||
unsigned long mflags = mi->flags & (~MS_PROPAGATE);
|
||||
|
||||
if (restore_shared_options(mi, !mi->shared_id && !mi->master_id, mi->shared_id, mi->master_id))
|
||||
return -1;
|
||||
|
||||
if (mflags && mount(NULL, service_mountpoint(mi), NULL, MS_REMOUNT | MS_BIND | mflags, NULL)) {
|
||||
pr_perror("Unable to apply root mount options");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return fetch_rt_stat(mi, service_mountpoint(mi));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user