Commit 304deda5 authored by Pavel Tikhomirov's avatar Pavel Tikhomirov Committed by Andrei Vagin

files: open files on overmounted mounts are not supported

Files from such mounts can switch on restore to different files on the
overmounting mount, as we yet don't fully control the mount on which
the file is restored.

v3: make mnt_is_overmounted boolean again
Signed-off-by: 's avatarPavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@gmail.com>
parent 830d1a18
...@@ -1261,7 +1261,7 @@ static bool should_check_size(int flags) ...@@ -1261,7 +1261,7 @@ static bool should_check_size(int flags)
int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p) int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p)
{ {
struct fd_link _link, *link; struct fd_link _link, *link;
struct ns_id *nsid; struct mount_info *mi;
struct cr_img *rimg; struct cr_img *rimg;
char ext_id[64]; char ext_id[64];
FileEntry fe = FILE_ENTRY__INIT; FileEntry fe = FILE_ENTRY__INIT;
...@@ -1285,13 +1285,18 @@ int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p) ...@@ -1285,13 +1285,18 @@ int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p)
goto ext; goto ext;
} }
nsid = lookup_nsid_by_mnt_id(p->mnt_id); mi = lookup_mnt_id(p->mnt_id);
if (nsid == NULL) { if (mi == NULL) {
pr_err("Can't lookup mount=%d for fd=%d path=%s\n", pr_err("Can't lookup mount=%d for fd=%d path=%s\n",
p->mnt_id, p->fd, link->name + 1); p->mnt_id, p->fd, link->name + 1);
return -1; return -1;
} }
if (mnt_is_overmounted(mi)) {
pr_err("Open files on overmounted mounts are not supported yet\n");
return -1;
}
if (p->mnt_id >= 0 && (root_ns_mask & CLONE_NEWNS)) { if (p->mnt_id >= 0 && (root_ns_mask & CLONE_NEWNS)) {
rfe.mnt_id = p->mnt_id; rfe.mnt_id = p->mnt_id;
rfe.has_mnt_id = true; rfe.has_mnt_id = true;
...@@ -1308,7 +1313,7 @@ int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p) ...@@ -1308,7 +1313,7 @@ int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p)
return -1; return -1;
} }
if (check_path_remap(link, p, lfd, id, nsid)) if (check_path_remap(link, p, lfd, id, mi->nsid))
return -1; return -1;
rfe.name = &link->name[1]; rfe.name = &link->name[1];
ext: ext:
......
...@@ -143,5 +143,6 @@ extern int check_mnt_id(void); ...@@ -143,5 +143,6 @@ extern int check_mnt_id(void);
extern int remount_readonly_mounts(void); extern int remount_readonly_mounts(void);
extern int try_remount_writable(struct mount_info *mi, bool ns); extern int try_remount_writable(struct mount_info *mi, bool ns);
extern bool mnt_is_overmounted(struct mount_info *mi);
#endif /* __CR_MOUNT_H__ */ #endif /* __CR_MOUNT_H__ */
...@@ -1150,7 +1150,7 @@ static int get_clean_fd(struct mount_info *mi) ...@@ -1150,7 +1150,7 @@ static int get_clean_fd(struct mount_info *mi)
* root of our mount namespace as it is covered by other mount. * root of our mount namespace as it is covered by other mount.
* mnt_is_overmounted() checks if mount is not visible. * mnt_is_overmounted() checks if mount is not visible.
*/ */
static bool mnt_is_overmounted(struct mount_info *mi) bool mnt_is_overmounted(struct mount_info *mi)
{ {
struct mount_info *t, *c, *m = mi; struct mount_info *t, *c, *m = mi;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment