[2/2] files: drop O_TMPFILE from file descriptor flags

Submitted by Andrei Vagin on Feb. 26, 2018, 9:37 p.m.


Message ID 20180226213753.29529-2-avagin@openvz.org
State New
Series "Series without cover letter"
Headers show

Commit Message

Andrei Vagin Feb. 26, 2018, 9:37 p.m.
[This sender failed our fraud detection checks and may not be who they appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing]

From: Andrei Vagin <avagin@virtuozzo.com>

Unnamed temporary files are restored as ghost files.

If O_TMPFILE is set for the open() syscall, the pathname argument
specifies a directory, but criu gives a path to a ghost file.

(00.107450)     36: Error (criu/files-reg.c:1757): Can't open file tmp/#42274874 on restore: Not a directory

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
 criu/files-reg.c | 3 +++
 1 file changed, 3 insertions(+)


Patch hide | download patch | download mbox

diff --git a/criu/files-reg.c b/criu/files-reg.c
index 5e63b964f..94fd4acaa 100644
--- a/criu/files-reg.c
+++ b/criu/files-reg.c
@@ -1752,6 +1752,9 @@  int do_open_reg_noseek_flags(int ns_root_fd, struct reg_file_info *rfi, void *ar
        u32 flags = *(u32 *)arg;
        int fd;

+       /* unnamed temporary files are restored as ghost files */
+       flags &= ~O_TMPFILE;
        fd = openat(ns_root_fd, rfi->path, flags);
        if (fd < 0) {
                pr_perror("Can't open file %s on restore", rfi->path);