1. 20 Apr, 2024 2 commits
  2. 14 Apr, 2024 2 commits
  3. 12 Apr, 2024 5 commits
  4. 08 Apr, 2024 3 commits
  5. 25 Mar, 2024 2 commits
  6. 24 Mar, 2024 1 commit
    • Han-Wen Nienhuys's avatar
      fuse: fix deadlock with parallel mounts · 36b35911
      Han-Wen Nienhuys authored
      Commit 1aa7b7b2 ("fs: document known deadlocks") describes a deadlock
      scenario where inheriting file descriptors triggers a spurious close
      during subprocess setup, leading to deadlock.
      
      This exact scenario actually happens when setting up the FUSE mount
      using fusermount: the fusermount process inherits one half of a socket
      pair, which is used to pass back the opened /dev/fuse file.  After the
      mount is successful, we open a file in the FUSE mount for the poll
      hack. This means that in parallel scenarios, we may use fd 3 as the
      poll hack, while also calling fusermount with inherited file
      descriptors.
      
      Solve this by grabbing fd 3 during initialization.
      
      This is not completely foolproof, as FD 0, 1 and 2 could be closed
      (and then reused) after initialization finished, but this should be
      uncommon as 0, 1 and 2 are standard input/output/error.
      
      Doing it during the init phase means that we prevent deadlock for all
      users that inherit single file descriptors.
      
      Change-Id: If5ac7c941f0ee2e13ca657c31d056a676eed3fde
      36b35911
  7. 09 Feb, 2024 1 commit
    • Han-Wen Nienhuys's avatar
      fuse: don't set flagname keyed by syscall.O_LARGEFILE · e9e7c22a
      Han-Wen Nienhuys authored
      On amd64, syscall.O_LARGEFILE is 0x0, making it be ignored as a
      key. However, the kernel always passes 0x8000 to the FUSE server for
      the OPEN call.
      
      The previous behavior causes crashes on 386, because the flagname is
      added twice.
      
      Change-Id: Ibabcdfef4d90e4fa4d02963d45a4d4cf2cba1ea2
      e9e7c22a
  8. 20 Nov, 2023 1 commit
  9. 13 Nov, 2023 2 commits
  10. 10 Nov, 2023 2 commits
  11. 08 Nov, 2023 2 commits
    • Han-Wen Nienhuys's avatar
      fs: document known deadlocks · 1aa7b7b2
      Han-Wen Nienhuys authored
      Change-Id: I1e10f22dc13207277af45cbbc2ac6740c9d4e36e
      1aa7b7b2
    • Han-Wen Nienhuys's avatar
      fuse/test: avoid low-numbered fds for FUSE-backed files · 27a473d5
      Han-Wen Nienhuys authored
      As part of the fork/exec sequence, file descriptors that should be
      inherited are remapped with dup3() in the chld process. This causes
      implicit file close operations. If the file descriptors are backed by
      FUSE, this leads to FLUSH operations. If parallelism is limited with
      GOMAXPROCS, this can cause a deadlock, as there will not be threads
      left to service the FLUSH opcodes.
      
      Fixes #489
      
      Change-Id: I81bf4ab0624495aabb5bb9ec42a55c6f23340beb
      27a473d5
  12. 05 Nov, 2023 1 commit
    • Han-Wen Nienhuys's avatar
      fuse: retain interface types · 22d9c9dc
      Han-Wen Nienhuys authored
      This avoids one allocation under lock (calling sync.Pool.Put converts to
      interface{})
      
      Change-Id: Icfe155e34300dca398cea99b73bc5e10fd362ae3
      22d9c9dc
  13. 01 Oct, 2023 1 commit
    • Yasin Turan's avatar
      fs: bridge: Add missing Lseek whence checks · fc2c4d3d
      Yasin Turan authored
      The man page for lseek(2) says that the filesystem should
      return an ENXIO when the offset is greater than the file
      size on either SEEK_DATA or SEEK_HOLE or if the offset is
      set to the end of the file with SEEK_DATA (where there is
      an implicit hole). Adding these checks to the current Lseek
      implementation.
      
      Change-Id: I8db0913a9e37209e1681ffd11a9afb7f39810132
      fc2c4d3d
  14. 30 Sep, 2023 1 commit
  15. 18 Sep, 2023 2 commits
  16. 11 Sep, 2023 1 commit
    • Han-Wen Nienhuys's avatar
      fuse: sync opcodes and capabilities · 043296a8
      Han-Wen Nienhuys authored
      This adds opcodes and capabilities from this week's upstream kernel.
      
      As of commit 53db28933 ("fuse: extend init flags"), the init message
      has been extended to 104 bytes, with more flags added in a flags2
      field.
      
      Prepare for this by allowing _OP_INIT to have short reads.
      
      Tested on Fedora 38 (Linux 6.4.14) and Fedora 34 (Linux 5.11)
      
      Change-Id: I366ecda9e23f1a329134677075ee839674ff4c57
      043296a8
  17. 10 Sep, 2023 2 commits
  18. 09 Sep, 2023 1 commit
    • Brandon Duffany's avatar
      Lazily init /dev/null fd · b5c46276
      Brandon Duffany authored
      Fixes an issue that the init() func in splice.go panics if
      /dev is not yet mounted.
      
      This allows supporting go-based init binaries which set up all the
      filesystems on the machine, including both /dev as well as
      FUSE-mounted dirs.
      
      Change-Id: I74dab18effe4df410689ae7a2ef43670fcab7bd8
      b5c46276
  19. 28 Aug, 2023 1 commit
  20. 22 Jun, 2023 2 commits
    • Han-Wen Nienhuys's avatar
      fs: return children in insertion order · 0b3e1fde
      Han-Wen Nienhuys authored
      Keep children in a slice of {name,*Inode} tuples, separately indexed
      by a string map.
      
      This ensures that we can return the children in insertion order. This
      fixes #476 and #391, and opens the road to NFS-compatible readdir
      cookies.
      
      Change-Id: I79b3483f4b12e67b63543da1294f725029a9139a
      0b3e1fde
    • Han-Wen Nienhuys's avatar
      fs: move children map into separate struct · 6eaf1ece
      Han-Wen Nienhuys authored
      Encapsulates the handling the children map, in preparation of changing
      the representation. It also reduces repetition for handling the
      parents field and changeCounter
      
      Change-Id: Ic741a376c6261dab606ed0705cdd130e70c8b69e
      6eaf1ece
  21. 21 Jun, 2023 1 commit
    • Jakob Unterwurzacher's avatar
      fuse: TestDirectMount: ignore `Optional` field · bb90a4c9
      Jakob Unterwurzacher authored
      As evidenced by the test failures that are reported, the
      `Optional` may change value between mounts. Ignore it
      in the comparison.
      
       --- FAIL: TestDirectMount (0.14s)
          mount_linux_test.go:173: DirectMount effective mount options mismatch:
              DirectMount: mountinfo.Info{ID:0, Parent:0, Major:0, Minor:0, Root:"", Mountpoint:"", Options:"rw,nosuid,nodev,relatime", Optional:"shared:417", FSType:"fuse./tmp/go-build3776165", Source:"a,b", VFSOptions:"rw,user_id=1000,group_id=1000,max_read=131072"}
              fusermount:  mountinfo.Info{ID:0, Parent:0, Major:0, Minor:0, Root:"", Mountpoint:"", Options:"rw,nosuid,nodev,relatime", Optional:"shared:373", FSType:"fuse./tmp/go-build3776165", Source:"a,b", VFSOptions:"rw,user_id=1000,group_id=1000,max_read=131072"}
      
      Fixes https://github.com/hanwen/go-fuse/issues/481
      
      Change-Id: Ie8105cf4bec7e7f461267217860cbf36e47ed329
      bb90a4c9
  22. 17 Jun, 2023 1 commit
  23. 16 Jun, 2023 2 commits
    • Kirill Smelkov's avatar
      fuse: Print debug flags in stable order · d5638ffd
      Kirill Smelkov authored
      This helps to compare fuse logs of e.g. different test runs. For example
      below are two INIT messages with the same flags, but formatted, before
      hereby patch, differently:
      
           rx 2: INIT n0 {7.37 Ra 131072 EXPORT_SUPPORT,SPLICE_READ,AUTO_INVAL_DATA,ASYNC_DIO,WRITEBACK_CACHE,BIG_WRITES,NO_OPEN_SUPPORT,PARALLEL_DIROPS,POSIX_ACL,EXPLICIT_INVAL_DATA,NO_OPENDIR_SUPPORT,ASYNC_READ,DONT_MASK,SPLICE_MOVE,IOCTL_DIR,READDIRPLUS,READDIRPLUS_AUTO,HANDLE_KILLPRIV,POSIX_LOCKS,ATOMIC_O_TRUNC,SPLICE_WRITE,FLOCK_LOCKS,ABORT_ERROR,MAX_PAGES,CACHE_SYMLINKS,0x70000000} "\x03\x00\x00\x00\x00\x00\x00\x00"... 48b
      
           rx 2: INIT n0 {7.37 Ra 131072 EXPORT_SUPPORT,SPLICE_READ,AUTO_INVAL_DATA,ASYNC_DIO,WRITEBACK_CACHE,BIG_WRITES,NO_OPEN_SUPPORT,PARALLEL_DIROPS,POSIX_ACL,EXPLICIT_INVAL_DATA,ASYNC_READ,DONT_MASK,SPLICE_MOVE,IOCTL_DIR,READDIRPLUS,READDIRPLUS_AUTO,HANDLE_KILLPRIV,NO_OPENDIR_SUPPORT,POSIX_LOCKS,ATOMIC_O_TRUNC,SPLICE_WRITE,FLOCK_LOCKS,ABORT_ERROR,MAX_PAGES,CACHE_SYMLINKS,0x70000000} "\x03\x00\x00\x00\x00\x00\x00\x00"... 48b
      
      which leads to corresponding lines to be present in the diff and
      requires human attention to verify that the messages are really the
      same.
      
      After this patch above INIT always formats as
      
           rx 2: INIT n0 {7.37 Ra 131072 ASYNC_READ,POSIX_LOCKS,ATOMIC_O_TRUNC,EXPORT_SUPPORT,BIG_WRITES,DONT_MASK,SPLICE_WRITE,SPLICE_MOVE,SPLICE_READ,FLOCK_LOCKS,IOCTL_DIR,AUTO_INVAL_DATA,READDIRPLUS,READDIRPLUS_AUTO,ASYNC_DIO,WRITEBACK_CACHE,NO_OPEN_SUPPORT,PARALLEL_DIROPS,HANDLE_KILLPRIV,POSIX_ACL,ABORT_ERROR,MAX_PAGES,CACHE_SYMLINKS,NO_OPENDIR_SUPPORT,EXPLICIT_INVAL_DATA,0x70000000} "\x03\x00\x00\x00\x00\x00\x00\x00"... 48b
      
      and the diff log does not unnecessarily distract attention to it.
      
      flagString is used for many messages, this fix should benefit all of
      them.
      
      Change-Id: Id4bdab9dd90552313ede41a3b9a6c337588e4b3e
      d5638ffd
    • Han-Wen Nienhuys's avatar
      fs: increase the limit for TestFileFdLeak · 9836d614
      Han-Wen Nienhuys authored
      The RELEASE opcode is asynchronous, so the next open() call may
      execute before the RELEASE for the preceding one has completed. In
      case of GOMAXPROCS=1, this happens often.
      
      Increase the limit to 15 to reduce the chance of this causing a test
      failure. The test runs 100 times, so this should still catch logic
      errors with deallocating file handles.
      
      Fixes #477.
      
      Change-Id: I12dbd96b2a6082e0f4a386d35983e6efcc596aef
      9836d614
  24. 14 Jun, 2023 1 commit
    • Kirill Smelkov's avatar
      fuse/test: Fix TestLargeDirRead · e5b78843
      Kirill Smelkov authored
      This test tries to create many files with random names and then asserts
      that readdir returns so many files that it created. But the test
      had a bug in that two random file names could be the same
      name but accounted twice. This leads to assertion in the end that the
      number of direntries read via readdir is not as expected.
      
      Here is how two random names could turn out to be the same:
      
      name 1: "file3" + "0" generated by randomLengthString
      name 2: "file30" + "" generated by randomLengthString
      
      -> Fix it by constructing random names guaranteed different.
      
      Fixes: https://github.com/hanwen/go-fuse/issues/472
      Change-Id: I776866bd728479da7324878d41dc71e504efd229
      e5b78843