[CRIU] [PATCH 3/3] devmap: mountpoint -- Allow to open mountpoint for mapped devices
Cyrill Gorcunov
gorcunov at openvz.org
Tue Nov 24 02:12:20 PST 2015
The mountpoint images are carrying former device IDs which
might be changed if restore procedure is happening on
another device (say we're migrating to new environment).
So don't fail in such case if mappings are provided.
https://jira.sw.ru/PSBM-41357
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
mount.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/mount.c b/mount.c
index 562d6ca5c3f3..6e8023399a5e 100644
--- a/mount.c
+++ b/mount.c
@@ -63,6 +63,22 @@ static struct ext_mount *ext_mount_lookup(char *key)
return NULL;
}
+static bool devmap_match(unsigned int from, unsigned int to,
+ struct cr_options *opts)
+{
+ if (opts->devmap) {
+ size_t i;
+
+ for (i = 0; i < opts->nr_devmap; i += 2) {
+ if (opts->devmap[i + 0] == from &&
+ opts->devmap[i + 1] == to)
+ return true;
+ }
+ }
+
+ return false;
+}
+
/*
* Single linked list of mount points get from proc/images
*/
@@ -1031,7 +1047,7 @@ int __open_mountpoint(struct mount_info *pm, int mnt_fd)
}
dev = phys_stat_resolve_dev(pm->nsid, st.st_dev, pm->ns_mountpoint + 1);
- if (dev != pm->s_dev) {
+ if (dev != pm->s_dev && !devmap_match(dev, pm->s_dev, &opts)) {
pr_err("The file system %#x (%#x) %s %s is inaccessible\n",
pm->s_dev, (int)dev, pm->fstype->name, pm->ns_mountpoint);
goto err;
--
2.5.0
More information about the CRIU
mailing list