main: fix fallocate for deleted files

allow to use fallocate on an unlinked path if there is still a
reference to it.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2020-01-13 22:24:32 +01:00
parent e01ba30da5
commit dfea3f9b63
No known key found for this signature in database
GPG Key ID: E4730F97F60286ED

4
main.c
View File

@ -4719,6 +4719,7 @@ ovl_fallocate (fuse_req_t req, fuse_ino_t ino, int mode, off_t offset, off_t len
struct ovl_data *lo = ovl_data (req);
cleanup_close int fd = -1;
struct ovl_node *node;
int dirfd;
int ret;
if (UNLIKELY (ovl_debug (req)))
@ -4739,7 +4740,8 @@ ovl_fallocate (fuse_req_t req, fuse_ino_t ino, int mode, off_t offset, off_t len
return;
}
fd = node->layer->ds->openat (node->layer, node->path, O_NONBLOCK|O_NOFOLLOW|O_WRONLY, 0755);
dirfd = node_dirfd (node);
fd = openat (dirfd, node->path, O_NONBLOCK|O_NOFOLLOW|O_WRONLY, 0755);
if (fd < 0)
{
fuse_reply_err (req, errno);