mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 18:07:57 +00:00
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>
This commit is contained in:
parent
00acf5228f
commit
d2762ddf77
@ -534,9 +534,9 @@ static int restore_one_fanotify(int fd, struct fsnotify_mark_info *mark)
|
|||||||
|
|
||||||
mntns_root = mntns_get_root_fd(m->nsid);
|
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) {
|
if (target == -1) {
|
||||||
pr_perror("Unable to open %s", m->mountpoint);
|
pr_perror("Unable to open %s", m->ns_mountpoint);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
mount.c
10
mount.c
@ -995,23 +995,23 @@ static int __open_mountpoint(struct mount_info *pm, int mnt_fd)
|
|||||||
if (mntns_root < 0)
|
if (mntns_root < 0)
|
||||||
return -1;
|
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) {
|
if (mnt_fd < 0) {
|
||||||
pr_perror("Can't open %s", pm->mountpoint);
|
pr_perror("Can't open %s", pm->ns_mountpoint);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = fstat(mnt_fd, &st);
|
ret = fstat(mnt_fd, &st);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
pr_perror("fstat(%s) failed", pm->mountpoint);
|
pr_perror("fstat(%s) failed", pm->ns_mountpoint);
|
||||||
goto err;
|
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) {
|
if (dev != pm->s_dev) {
|
||||||
pr_err("The file system %#x (%#x) %s %s is inaccessible\n",
|
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;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1017,6 +1017,7 @@ static int parse_mountinfo_ent(char *str, struct mount_info *new, char **fsname)
|
|||||||
new->mountpoint = xmalloc(PATH_MAX);
|
new->mountpoint = xmalloc(PATH_MAX);
|
||||||
if (new->mountpoint == NULL)
|
if (new->mountpoint == NULL)
|
||||||
goto err;
|
goto err;
|
||||||
|
new->ns_mountpoint = new->mountpoint;
|
||||||
|
|
||||||
new->mountpoint[0] = '.';
|
new->mountpoint[0] = '.';
|
||||||
ret = sscanf(str, "%i %i %u:%u %ms %s %ms %n",
|
ret = sscanf(str, "%i %i %u:%u %ms %s %ms %n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user