Skip to content

Commit 9f631ad

Browse files
avaginxemul
authored andcommitted
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 a082f27 -- 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 <[email protected]> Signed-off-by: Cyrill Gorcunov <[email protected]> Signed-off-by: Pavel Emelyanov <[email protected]>
1 parent 14da0f7 commit 9f631ad

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

fsnotify.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,9 @@ static int restore_one_fanotify(int fd, struct fsnotify_mark_info *mark)
536536

537537
mntns_root = mntns_get_root_fd(m->nsid);
538538

539-
target = openat(mntns_root, m->mountpoint, O_PATH);
539+
target = openat(mntns_root, m->ns_mountpoint, O_PATH);
540540
if (target == -1) {
541-
pr_perror("Unable to open %s", m->mountpoint);
541+
pr_perror("Unable to open %s", m->ns_mountpoint);
542542
goto err;
543543
}
544544

mount.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -1017,23 +1017,23 @@ static int __open_mountpoint(struct mount_info *pm, int mnt_fd)
10171017
if (mntns_root < 0)
10181018
return -1;
10191019

1020-
mnt_fd = openat(mntns_root, pm->mountpoint, O_RDONLY);
1020+
mnt_fd = openat(mntns_root, pm->ns_mountpoint, O_RDONLY);
10211021
if (mnt_fd < 0) {
1022-
pr_perror("Can't open %s", pm->mountpoint);
1022+
pr_perror("Can't open %s", pm->ns_mountpoint);
10231023
return -1;
10241024
}
10251025
}
10261026

10271027
ret = fstat(mnt_fd, &st);
10281028
if (ret < 0) {
1029-
pr_perror("fstat(%s) failed", pm->mountpoint);
1029+
pr_perror("fstat(%s) failed", pm->ns_mountpoint);
10301030
goto err;
10311031
}
10321032

1033-
dev = phys_stat_resolve_dev(pm->nsid, st.st_dev, pm->mountpoint + 1);
1033+
dev = phys_stat_resolve_dev(pm->nsid, st.st_dev, pm->ns_mountpoint + 1);
10341034
if (dev != pm->s_dev) {
10351035
pr_err("The file system %#x (%#x) %s %s is inaccessible\n",
1036-
pm->s_dev, (int)dev, pm->fstype->name, pm->mountpoint);
1036+
pm->s_dev, (int)dev, pm->fstype->name, pm->ns_mountpoint);
10371037
goto err;
10381038
}
10391039

proc_parse.c

+1
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,7 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new, char **fsname)
10261026
new->mountpoint = xmalloc(PATH_MAX);
10271027
if (new->mountpoint == NULL)
10281028
goto err;
1029+
new->ns_mountpoint = new->mountpoint;
10291030

10301031
new->mountpoint[0] = '.';
10311032
ret = sscanf(str, "%i %i %u:%u %ms %s %ms %n",

0 commit comments

Comments
 (0)