diff options
author | Pavel Tikhomirov <ptikhomirov@virtuozzo.com> | 2022-06-22 13:09:20 +0300 |
---|---|---|
committer | Andrei Vagin <avagin@gmail.com> | 2022-08-31 01:11:33 +0300 |
commit | 2666eec7bbb34e3d9099a46bf12fd8e6c124179e (patch) | |
tree | 20b63717ae0d3cccdb58a9df08c93f982a300d0d | |
parent | 94bfff77edac467b69b787f7aaf0ba4fac1feb95 (diff) |
files-reg: skip failed mount lookup for shell-job's tty
When we restore a shell-job we would inherit tty-s, so even if we don't
have a right mount for it in container on dump, on restore it should
just be right.
Else when dumping second time via criu-ns we get:
(00.005678) Error (criu/files-reg.c:1710): Can't lookup mount=29 for fd=0 path=/dev/pts/20
Fixes: #1893
Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
-rw-r--r-- | criu/files-reg.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/criu/files-reg.c b/criu/files-reg.c index c3761b5ed..2e3d57c5e 100644 --- a/criu/files-reg.c +++ b/criu/files-reg.c @@ -14,6 +14,8 @@ #include <sys/mount.h> #include <elf.h> +#include "tty.h" + #ifndef SEEK_DATA #define SEEK_DATA 3 #define SEEK_HOLE 4 @@ -1689,6 +1691,7 @@ int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p) int ret; FileEntry fe = FILE_ENTRY__INIT; RegFileEntry rfe = REG_FILE_ENTRY__INIT; + bool skip_for_shell_job = false; if (!p->link) { if (fill_fdlink(lfd, p, &_link)) @@ -1708,11 +1711,15 @@ int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p) mi = lookup_mnt_id(p->mnt_id); if (mi == NULL) { - pr_err("Can't lookup mount=%d for fd=%d path=%s\n", p->mnt_id, p->fd, link->name + 1); - return -1; + if (opts.shell_job && is_tty(p->stat.st_rdev, p->stat.st_dev)) { + skip_for_shell_job = true; + } else { + pr_err("Can't lookup mount=%d for fd=%d path=%s\n", p->mnt_id, p->fd, link->name + 1); + return -1; + } } - if (mnt_is_overmounted(mi)) { + if (!skip_for_shell_job && mnt_is_overmounted(mi)) { pr_err("Open files on overmounted mounts are not supported yet\n"); return -1; } @@ -1732,7 +1739,7 @@ int dump_one_reg_file(int lfd, u32 id, const struct fd_parms *p) return -1; } - if (check_path_remap(link, p, lfd, id, mi->nsid)) + if (!skip_for_shell_job && check_path_remap(link, p, lfd, id, mi->nsid)) return -1; rfe.name = &link->name[1]; ext: |