From 2d90664f248ab77ad37ef86355f76c70da3c6abe Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 24 Aug 2022 13:25:00 +0200 Subject: [PATCH] main: fix copy_file_range for deleted files if the file was deleted, access it through the hidden_dirfd. Closes: https://github.com/containers/fuse-overlayfs/issues/368 Signed-off-by: Giuseppe Scrivano --- main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 83fe8e7..af05f57 100644 --- a/main.c +++ b/main.c @@ -5394,7 +5394,10 @@ ovl_copy_file_range (fuse_req_t req, fuse_ino_t ino_in, off_t off_in, struct fus return; } - fd = node->layer->ds->openat (node->layer, node->path, O_NONBLOCK|O_NOFOLLOW|O_RDONLY, 0755); + if (node->hidden) + fd = openat (node->hidden_dirfd, node->path, O_NONBLOCK|O_NOFOLLOW|O_RDONLY, 0755); + else + fd = node->layer->ds->openat (node->layer, node->path, O_NONBLOCK|O_NOFOLLOW|O_RDONLY, 0755); if (fd < 0) { fuse_reply_err (req, errno);