[CRIU] [PATCH] mount: treat non-openable mountpoint as unreachable
Pavel Tikhomirov
ptikhomirov at virtuozzo.com
Mon Nov 20 17:54:42 MSK 2017
a) By default systemd creates a separate mount namespace for mysql,
setups "slave" mount propagation for /run and also mounts tmpfs to
/run/user in these ns, because of:
cat /usr/lib/systemd/system/mariadb.service | grep "/run/user" -A1
ProtectHome=true
rpm -qf /usr/lib/systemd/system/mariadb.service
MariaDB-server-10.2.10-1.el7.centos.x86_64
b) When ssh(root) is connected - systemd mounts tmpfs in container root
mount namespace to /run/user/0. As /run is slave mount /run/user/0 also
propagates to mysql's mount namespace and initially is put under
/run/user - becoming overmounted.
c) Criu is not yet able to dump overmounted tmpfs
So we have error when dumping mariadb CT with active ssh inside:
prlctl suspend mariadb-downloaded
Suspending the CT...
...
(02.432423) Error (criu/mount.c:1202): mnt: Can't open ./run/user/0: No
such file or directory
(02.465827) Error (criu/cr-dump.c:2005): Dumping FAILED.
To fix these we can just skip these mount_info in dump_one_fs and look
for a better bind-mount candidate, which, for our case, exists in
container root mntns.
note1: I'm not sure how to do a test for these as error depends on
the order of bindmounts in criu's representation.
note2: Other options is to support dumping overmounted mounts.
https://jira.sw.ru/browse/PSBM-57362
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
criu/mount.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/criu/mount.c b/criu/mount.c
index ccd3fef2c..d5cd7b535 100644
--- a/criu/mount.c
+++ b/criu/mount.c
@@ -1007,6 +1007,7 @@ int mnt_is_dir(struct mount_info *pm)
return 0;
}
+#define MNT_UNREACHABLE INT_MIN
/*
* mnt_fd is a file descriptor on the mountpoint, which is closed in an error case.
* If mnt_fd is -1, the mountpoint will be opened by this function.
@@ -1026,8 +1027,8 @@ int __open_mountpoint(struct mount_info *pm, int mnt_fd)
mnt_fd = openat(mntns_root, pm->ns_mountpoint, O_RDONLY);
if (mnt_fd < 0) {
- pr_perror("Can't open %s", pm->ns_mountpoint);
- return -1;
+ pr_warn("Can't open %s", pm->ns_mountpoint);
+ return MNT_UNREACHABLE;
}
}
@@ -1097,7 +1098,6 @@ static char *get_clean_mnt(struct mount_info *mi, char *mnt_path_tmp, char *mnt_
return mnt_path;
}
-#define MNT_UNREACHABLE INT_MIN
int open_mountpoint(struct mount_info *pm)
{
struct mount_info *c;
--
2.13.6
More information about the CRIU
mailing list