git: sys/vfs/fuse: Fix a ton of stuff and get writes working

Tomohiro Kusumi kusumi.tomohiro at gmail.com
Fri Mar 15 00:51:44 PDT 2024


Thanks for write support they look great, but I don't see how fh works
in general with this.
This is something similar to what FreeBSD initially had when it first appeared.
It can of course work under certain conditions.

I'm guessing you're seeing FUSE fh as something similar to NFS.

I believe how FreeBSD implements FUSE fh (per-node linked list) today
is the best they/we can do without VFS changes, but that too isn't
perfect.
It only mitigates problems that can happen depending on what userspace
stores into fh (fd, pointer, whatever they want to put basically...).


2024年3月14日(木) 23:38 Matthew Dillon <dillon at crater.dragonflybsd.org>:
>
>
> commit 5d0d0bafbc717a20af3abdbf6366fee0ae276685
> Author: Matthew Dillon <dillon at apollo.backplane.com>
> Date:   Thu Mar 14 23:26:40 2024 -0700
>
>     sys/vfs/fuse: Fix a ton of stuff and get writes working
>
>     * Recode all the file I/O.  Use the buffer cache properly, create a
>       backend for BIO strategy calls.  mmap() should work properly now.
>       write() should also now work properly.
>
>     * For the moment issue vfinalize() when the opencount == 0 to force
>       the DFly kernel to dispose of inactive vnodes once all references
>       (including mmap references) are gone.
>
>     * Recode the filehandle (fh) tracking.   File handles are assigned
>       in fuse_vop_open() and instead of being released in fuse_vop_close()
>       (which completely blows up mmap() operations), we now release
>       file handles in fuse_vop_inactive().
>
>       Remove the fh side allocation.  The fh is now positively stored in
>       the fuse_node.
>
>     * Properly zero data structures allocated via the objcache.
>
>     * Implement the new syncer thread / syncer scan API for fsync
>       operations.
>
>     * Implement asynchronous I/O in the frontend (the backend helper thread
>       is currently still synchronous).
>
>     * Rejigger how attributes are handled when the file size changes.
>       It is still a bit of a mess but it is better than before.  The
>       basic problem is that the file attribute info in userland does
>       not update the file size field until we flush the BIOs related
>       to an append.
>
>     * Not yet fixed: hard link related issues (duplicate fuse_node inodes
>       are allocated).
>
>       nlink tracking was a mess.  Adjust fuse_node->nlink to only track
>       the allocated directory entries on the kernel side.  Do not try
>       to update it against attribute nlink counts.  We always report
>       thte attribute nlink counts... the fuse_node->nlink only tracks
>       local directory entries for the moment.
>
>     * Fix a use-after-free situation that can develop with the root vnode
>       for the fuse filesystem.
>
>     * Properly disconnect fnp->pfnp linkages and move connection and
>       disconnection to fuse_dent_attach() and fuse_dent_detach().
>
>     * Improve atomicy in fuse_node_vn().
>
>     * Implement advisory locks locally on the kernel side.
>
>     * Not yet fixed: Multiple fuse_node's can have the same inode because
>       we are not yet indexing them by inode number.
>
> Summary of changes:
>  sys/vfs/fuse/Makefile      |   2 +-
>  sys/vfs/fuse/fuse.h        |  31 +-
>  sys/vfs/fuse/fuse_file.c   | 115 ------
>  sys/vfs/fuse/fuse_io.c     |  13 +-
>  sys/vfs/fuse/fuse_ipc.c    |   4 +-
>  sys/vfs/fuse/fuse_node.c   | 132 ++++---
>  sys/vfs/fuse/fuse_vfsops.c |  92 ++++-
>  sys/vfs/fuse/fuse_vnops.c  | 867 +++++++++++++++++++++++++++++++++++++--------
>  8 files changed, 900 insertions(+), 356 deletions(-)
>  delete mode 100644 sys/vfs/fuse/fuse_file.c
>
> http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/5d0d0bafbc717a20af3abdbf6366fee0ae276685
>
>
> --
> DragonFly BSD source repository


More information about the Commits mailing list