diff options
author | Andrew Vagin <avagin@openvz.org> | 2015-10-09 18:59:00 +0300 |
---|---|---|
committer | Pavel Emelyanov <xemul@parallels.com> | 2015-10-22 16:13:21 +0300 |
commit | d2762ddf77dc1121ac876d6d857fbab968ee25b0 (patch) | |
tree | 84e0672f2aef60028221608e8a6998a1b0fe71dc | |
parent | 00acf5228fbb16f1768b8ed040cb901df291f1db (diff) |
mnt: Use ns_mountpoint to open a mount point
open_mountpoint helper is called when mount namespace are
already restored so we have to use local paths.
This is a continuation to patch a082f27b -- we keep mount
point id in fsnotify, thus we should use the namespace's
path for open.
https://jira.sw.ru/browse/PSBM-39957
Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
-rw-r--r-- | fsnotify.c | 4 | ||||
-rw-r--r-- | mount.c | 10 | ||||
-rw-r--r-- | proc_parse.c | 1 |
3 files changed, 8 insertions, 7 deletions
diff --git a/fsnotify.c b/fsnotify.c index b8f9c227d..adeaa7f2e 100644 --- a/fsnotify.c +++ b/fsnotify.c @@ -534,9 +534,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; } @@ -995,23 +995,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 cf70a92d0..515785382 100644 --- a/proc_parse.c +++ b/proc_parse.c @@ -1017,6 +1017,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", |