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

Matthew Dillon dillon at
Thu Mar 14 23:38:39 PDT 2024

commit 5d0d0bafbc717a20af3abdbf6366fee0ae276685
Author: Matthew Dillon <dillon at>
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
    * 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

DragonFly BSD source repository

More information about the Commits mailing list