[CRIU] [PATCH] mnt: Use ns_mountpoint to open a mount point
Cyrill Gorcunov
gorcunov at openvz.org
Fri Oct 9 08:59:22 PDT 2015
From: Andrew Vagin <avagin at openvz.org>
open_mountpoint helper is called when mount namespace are
already restored so we have to use local paths.
https://jira.sw.ru/browse/PSBM-39957
Signed-off-by: Andrew Vagin <avagin at openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
fsnotify.c | 4 ++--
mount.c | 10 +++++-----
proc_parse.c | 1 +
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/fsnotify.c b/fsnotify.c
index 0d9ec58446b1..3a81a528d7c5 100644
--- a/fsnotify.c
+++ b/fsnotify.c
@@ -526,9 +526,9 @@ static int restore_one_fanotify(int fd, struct fsnotify_mark_info *mark)
mntns_root = mntns_get_root_fd(m->nsid);
- target = openat(mntns_root, m->mountpoint, O_PATH);
+ target = openat(mntns_root, m->ns_mountpoint, O_PATH);
if (target == -1) {
- pr_perror("Unable to open %s", m->mountpoint);
+ pr_perror("Unable to open %s", m->ns_mountpoint);
goto err;
}
diff --git a/mount.c b/mount.c
index 2ed061592f86..8936eda59db5 100644
--- a/mount.c
+++ b/mount.c
@@ -1017,23 +1017,23 @@ static int __open_mountpoint(struct mount_info *pm, int mnt_fd)
if (mntns_root < 0)
return -1;
- mnt_fd = openat(mntns_root, pm->mountpoint, O_RDONLY);
+ mnt_fd = openat(mntns_root, pm->ns_mountpoint, O_RDONLY);
if (mnt_fd < 0) {
- pr_perror("Can't open %s", pm->mountpoint);
+ pr_perror("Can't open %s", pm->ns_mountpoint);
return -1;
}
}
ret = fstat(mnt_fd, &st);
if (ret < 0) {
- pr_perror("fstat(%s) failed", pm->mountpoint);
+ pr_perror("fstat(%s) failed", pm->ns_mountpoint);
goto err;
}
- dev = phys_stat_resolve_dev(pm->nsid, st.st_dev, pm->mountpoint + 1);
+ dev = phys_stat_resolve_dev(pm->nsid, st.st_dev, pm->ns_mountpoint + 1);
if (dev != pm->s_dev) {
pr_err("The file system %#x (%#x) %s %s is inaccessible\n",
- pm->s_dev, (int)dev, pm->fstype->name, pm->mountpoint);
+ pm->s_dev, (int)dev, pm->fstype->name, pm->ns_mountpoint);
goto err;
}
diff --git a/proc_parse.c b/proc_parse.c
index 965c7cbc47c0..7cc6b61a93f4 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -1026,6 +1026,7 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new, char **fsname)
new->mountpoint = xmalloc(PATH_MAX);
if (new->mountpoint == NULL)
goto err;
+ new->ns_mountpoint = new->mountpoint;
new->mountpoint[0] = '.';
ret = sscanf(str, "%i %i %u:%u %ms %s %ms %n",
--
2.4.3
More information about the CRIU
mailing list