Skip to content

Commit

Permalink
document-portal: Don't invalidate directories
Browse files Browse the repository at this point in the history
This works around issue #1234. This is a followup from #1190.

fuse_lowlevel_notify_inval_entry() will invalidate directories too,
which is a problem as it invalidate the current workdir directory.
So now we don't invalidate them and will let the kernel deal with it.

This is consistent with the passthrough_hp example from fuse.

But this still make the directory being held for longer than
necessary.

Signed-off-by: Hubert Figuière <[email protected]>
  • Loading branch information
hfiguiere committed Jan 13, 2024
1 parent fd70f57 commit 1de051b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions document-portal/document-portal-fuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1847,17 +1847,21 @@ xdp_fuse_lookup (fuse_req_t req,
}
else
{
g_autoptr(XdpInode) inode = NULL;
struct stat buf;

g_assert (parent_domain->type == XDP_DOMAIN_DOCUMENT);

fd = xdp_document_inode_open_child_fd (parent, name, open_flags, 0);
if (fd < 0)
return xdp_reply_err (op, req, -fd);

res = ensure_docdir_inode (parent, fd, &e, NULL); /* Takes ownership of fd */
res = ensure_docdir_inode (parent, fd, &e, &inode); /* Takes ownership of fd */
if (res != 0)
return xdp_reply_err (op, req, -res);

queue_invalidate_dentry (parent, name);
if (fstat (inode->physical->fd, &buf) != 0 || !S_ISDIR(buf.st_mode))
queue_invalidate_dentry (parent, name);
}

g_debug ("LOOKUP %lx:%s => %lx", parent_ino, name, e.ino);
Expand Down

0 comments on commit 1de051b

Please sign in to comment.