1. 24 Jul, 2023 1 commit
    • Kirill Smelkov's avatar
      Merge branch 'master' into y/nodefs-cancel · aebdd447
      Kirill Smelkov authored
      Not notable patches - we only sync to pick up fixes for the tests and
      debug print adjustment to print flags with stable order.
      
      See nexedi/wendelin.core!16 (comment 188001)
      for context.
      
      * master:
        fs: return children in insertion order
        fs: move children map into separate struct
        fuse: TestDirectMount: ignore `Optional` field
        fuse: Don't print default if flags != 0
        fuse: Print debug flags in stable order
        fs: increase the limit for TestFileFdLeak
        fuse/test: Fix TestLargeDirRead
        .github: also test GOMAXPROCS=1
      aebdd447
  2. 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
  3. 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
  4. 17 Jun, 2023 1 commit
  5. 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
  6. 14 Jun, 2023 3 commits
    • 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
    • Kirill Smelkov's avatar
      Merge branch 'master' into y/nodefs-cancel · eb4d413d
      Kirill Smelkov authored
      Notable patches:
      
      - 265a3926 "fuse: Increase MAX_KERNEL_WRITE to 1 MiB & enable CAP_MAX_PAGES"
      
        this should affect WCFS performance significantly because previously data was
        read from WCFS server in 128KB chunks and now it could be read in 2MB.
      
        For the reference: WCFS was setting MaxWrite=2MB from the beginning, and
        previously it was capped to 128KB by go-fuse. Now with go-fuse upgrade we
        should hopefully automatically get increase in performance.
      
      - 90b055af "fusermount: Fix option escaping"
      
        Levin's patch to allow ',' to be present in fsname, so that we can mount
        neo:// with multiple masters.
      
        See nexedi/wendelin.core!15 for context
        and details.
      
      * master: (45 commits)
        fs: kill subprocess before tearing down test
        fuse/test: Fix TestFopenKeepCache, take 2
        fs: simplify TestReadDirStress
        fuse: tweak Unmount doc comment
        .github: add Go 1.20
        fuse/mount_linux_test/DirectMount: Verify FsName \w comma/backslash works
        fusermount: Fix option escaping
        fuse: fix debug print for FsyncDir
        fuse: print GETATTR flags in input
        fs: document FileHandle argument for Getattr
        README.md: tweak & polish
        Drop "// " from LICENSE
        fs: fix NodeLookuper documentation
        .github: set user_allow_other in /etc/fuse.conf
        .github: drop Go 1.13 / 1.15, add Go 1.18/1.19
        fuse: MountDirect: always pass max_read
        tests: TestDirectMount: better coverage, clearer output
        fs: document Readdir determinism requirement
        fs: fold duplicate fuse.Context{} instantiations
        newunionfs: make readdir deterministic
        ...
      eb4d413d
    • Kirill Smelkov's avatar
      fixup! Y nodefs: Propagate context to File methods · 6e5a2cc2
      Kirill Smelkov authored
      Darwin build was failing:
      
          $ ./all.bash
          + go build ./...
          + GOOS=darwin
          + go build ./fuse/... ./fs/... ./example/loopback/...
          # github.com/hanwen/go-fuse/fuse/nodefs
          fuse/nodefs/files.go:99:9: cannot use &loopbackFile{…} (value of type *loopbackFile) as File value in return statement: *loopbackFile does not implement File (wrong type for method Allocate)
                          have Allocate(uint64, uint64, uint32) fuse.Status
                          want Allocate(uint64, uint64, uint32, *fuse.Context) (fuse.Status)
          fuse/nodefs/files_darwin.go:87:22: not enough arguments in call to f.GetAttr
                  have (*fuse.Attr)
                  want (*fuse.Attr, *fuse.Context)
      6e5a2cc2
  7. 12 Jun, 2023 2 commits
  8. 11 Jun, 2023 1 commit
    • Kirill Smelkov's avatar
      fuse/test: Fix TestFopenKeepCache, take 2 · d2138350
      Kirill Smelkov authored
      In 2019 TestOpenKeepCache was first disabled in ce2558b4 (fuse/test:
      disable TestFopenKeepCache) and then reenabled in 904ef0cc (fuse/test:
      Fix TestFopenKeepCache). The latter patch hoped to fix this test
      
          - by disabling CAP_AUTO_INVAL_DATA via ExplicitDataCacheControl. This
            should stop kernel from dropping data cache on mtime change;
          - by using the same size for before and after states. This avoid hitting
            cache being dropped when kernel sees file size being changed.
      
      In other words it took actions so that the data cache is not
      unexpectedly dropped by the kernel and the test does not fail with
      seeing different content after file reopen.
      
      However the test also wants to verify that updated data can be seen
      after cache invalidation and here it was not exactly correct: the test
      requested full control over the data cache via ExplicitDataCacheControl
      mount option, but was explicitly invalidating only file attributes
      via pathfs.EntryNotify _without_ invalidating the data cache.
      
      This way the test was actually working before Linux 5.2, because those
      older kernels never negotiate CAP_EXPLICIT_INVAL_DATA(*), but starting
      from Linux 5.2 CAP_EXPLICIT_INVAL_DATA started to be negotiated, and so
      the kernel was dropping only metadata without invalidating data cache on
      EntryNotify. This started to lead to the following test failures:
      
          --- FAIL: TestFopenKeepCache (0.13s)
              cache_test.go:153: ReadFile: got "before" after notify, want "afterX"
      
      @hanwen explains in https://github.com/hanwen/go-fuse/issues/473#issuecomment-1585617107
      
          It tries to invalidate the file content by issuing an ENTRY_NOTIFY. This
          leads to different mtime returned, but in the init phase, we don´t
          return AUTO_INVAL_DATA, because setupCacheTest explicitly disables it.
      
          === RUN   TestFopenKeepCache
          12:47:49.958227 callFusermount: executing ["/usr/bin/fusermount3" "/tmp/TestFopenKeepCache1094589261/001/mnt" "-o" "subtype=pathfs.pathInode,max_read=131072"]
          12:47:49.967664 rx 2: INIT n0 {7.38 Ra 131072 FLOCK_LOCKS,IOCTL_DIR,READDIRPLUS,READDIRPLUS_AUTO,PARALLEL_DIROPS,HANDLE_KILLPRIV,ASYNC_READ,BIG_WRITES,SPLICE_WRITE,SPLICE_MOVE,WRITEBACK_CACHE,NO_OPEN_SUPPORT,POSIX_ACL,POSIX_LOCKS,EXPORT_SUPPORT,AUTO_INVAL_DATA,ASYNC_DIO,MAX_PAGES,CACHE_SYMLINKS,NO_OPENDIR_SUPPORT,DONT_MASK,SPLICE_READ,ABORT_ERROR,EXPLICIT_INVAL_DATA,ATOMIC_O_TRUNC,0x70000000} "\a\x00\x00\x00\x00\x00\x00\x00"... 48b
          12:47:49.967708 tx 2:     OK, {7.28 Ra 131072 BIG_WRITES,NO_OPEN_SUPPORT,MAX_PAGES,EXPLICIT_INVAL_DATA,ASYNC_READ,READDIRPLUS,PARALLEL_DIROPS 0/0 Wr 131072 Tg 0 MaxPages 32}
      
      -> Let's fix this.
      
      As explained in 904ef0cc we do not want to reenable AUTO_INVAL_DATA
      because then the kernel will start dropping data cache on mtime change
      and the test will start to fail in its first part - where we want to
      assert that the data stays the same until data cache is invalidated.
      
      So let's change EntryNotify to FileNotify to explicitly invalidate data
      cache when we want the file to read with new data.
      
      Hopefully fixes: https://github.com/hanwen/go-fuse/issues/473
      
      (*) see git.kernel.org/linus/ad2ba64dd489 and github.com/hanwen/go-fuse/pull/273
      
      Change-Id: I4ff0f2bef61f0217601eee6d272f7e5563b272d2
      d2138350
  9. 09 Jun, 2023 2 commits
  10. 08 Jun, 2023 2 commits
  11. 07 Jun, 2023 1 commit
  12. 25 May, 2023 1 commit
  13. 18 May, 2023 2 commits
  14. 26 Apr, 2023 1 commit
  15. 23 Apr, 2023 2 commits
  16. 21 Apr, 2023 2 commits
    • Jakob Unterwurzacher's avatar
      .github: set user_allow_other in /etc/fuse.conf · 652da3f9
      Jakob Unterwurzacher authored
      Fixes this test failure:
      
      2023/04/13 20:25:20 callFusermount: executing ["/usr/bin/fusermount3" "/tmp/TestDirectMount4166040800" "-o" "allow_other,subtype=/tmp/go-build1065896,max_read=131072"]
      /usr/bin/fusermount3: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf
      
      \--- FAIL: TestDirectMount (0.01s)
          mount_linux_test.go:117: fusermount exited with code 256
      
      Change-Id: I4a2a2983dd422de9360b17068ac0d8a3947d453d
      652da3f9
    • Han-Wen Nienhuys's avatar
      .github: drop Go 1.13 / 1.15, add Go 1.18/1.19 · 1e62711b
      Han-Wen Nienhuys authored
      Change-Id: Ifb84efcb76615cc492c867afb9e1840a6977d402
      1e62711b
  17. 12 Apr, 2023 2 commits
  18. 10 Apr, 2023 5 commits
  19. 09 Apr, 2023 1 commit
    • Han-Wen Nienhuys's avatar
      fs: buffer error in directory reads · 17756c7c
      Han-Wen Nienhuys authored
      Previously, if a DirStream.Next() call would return error, we would
      return the buffered data as well as the errno code in the same
      request.
      
      This would confuse the kernel, who interprets this as an invalid
      response, returning syscall.EIO to the caller.
      
      To fix this, also buffer the errno as overflow entry in the fileEntry
      struct. When we encounter an error, return thus far read entries with
      success. The following read contains just the error.
      
      For testing this properly, loopbackDirStream (which reads directory
      contents) must also buffer error returns.
      
      Change-Id: Ideb8ea6f540de9189a0f366efca0db2205e5dec3
      17756c7c
  20. 07 Apr, 2023 6 commits