1. 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
  2. 07 Apr, 2023 7 commits
  3. 05 Apr, 2023 1 commit
  4. 29 Mar, 2023 1 commit
  5. 23 Mar, 2023 1 commit
  6. 19 Mar, 2023 2 commits
  7. 21 Feb, 2023 1 commit
  8. 05 Feb, 2023 1 commit
    • ZheNing Hu's avatar
      mount: add Options{RootStableAttr} field · 615a0a7e
      ZheNing Hu authored
      - provides an optional way to set e.g. Ino and/or Gen for
        the root directory when calling fs.Mount()
      - provides unit test cases
      - partial fix for #399
      
      Change-Id: If45a0ec3c0ea06c0419913e34b3415808f9349da
      615a0a7e
  9. 30 Jan, 2023 7 commits
    • Jakob Unterwurzacher's avatar
      example: loopback: add -directmount, -directmountstrict flags · de5d9718
      Jakob Unterwurzacher authored
      Allows to enable the DirectMount{,Strict} flag through the cli,
      facilitating testing.
      
      Change-Id: I46e273ea68e6a81b4e7873802bc3b1c7760f56f0
      de5d9718
    • Jakob Unterwurzacher's avatar
      example: loopback: use FsName field · 56d54486
      Jakob Unterwurzacher authored
      Commit
      
      	17c7e2cd loopback: show original directory in "df"
      
      added the FsName field to MountOptions, but looks like
      
      	d31db957 fuse: allow setting the fsname (first column in df -T)
      
      forgot that it exists. Use it now.
      
      This will be important for DirectMount, as passing "fsname=xxx" to
      the mount syscall causes the kernel to reject with EINVAL and this
      message in dmesg:
      
      	[132274.900267] fuse: Unknown parameter 'fsname'
      
      Change-Id: Ic1233fe9306e2ce05f85189eecceecec2baa44b7
      56d54486
    • Jakob Unterwurzacher's avatar
      example: loopback: pull MountOptions into opts initializer · 59d90a47
      Jakob Unterwurzacher authored
      These were open-coded before. Pull them into the struct
      initializer for somewhat clearer code.
      
      I'm doing this now as I'm about to add another option.
      
      Change-Id: Ie04cfc9fb1f4128b8faf5c85757d7263aa77e5a0
      59d90a47
    • Jakob Unterwurzacher's avatar
      fuse: DirectMount: replace hard-coded mount options · 3de2e5e1
      Jakob Unterwurzacher authored
      Do what fusermount does instead of hard-coding the strings.
      
      Change-Id: Idf18f1c5cd17b7f9db8e15e8bc5173d0f6ca41db
      3de2e5e1
    • Jakob Unterwurzacher's avatar
      fuse: fix DirectMount mixups · 039d39cf
      Jakob Unterwurzacher authored
      Two variable were defined but never used in what looks like
      a copy-paste error or something.
      
      Fix that, which also makes the tests pass.
      
      Change-Id: Iebf48583874977c518d888d9a80bc1f02e2a7f86
      039d39cf
    • Jakob Unterwurzacher's avatar
      fuse, fs: add DirectMount tests & DirectMountStrict option · 05c0aea6
      Jakob Unterwurzacher authored
      Reason for adding DirectMountStrict is making the DirectMount
      functionality testable, though it may have value for the user
      in some cases.
      
      Add defaultRawFileSystem & loopback tests for DirectMount
      and DirectMountStrict.
      
      The tests fail right now due to bugs in DirectMount that will be fixed
      shortly:
      
      	go-fuse/fuse$ sudo /usr/local/go/bin/go test -run TestDirectMount
      	[...]
      	2022/12/28 20:19:21 mountDirect: calling syscall.Mount("", "/tmp/TestDirectMount3242971772", "fuse./tmp/go-build1215740", 0x0, "fd=7,rootmode=40000,user_id=0,group_id=0")
      	2022/12/28 20:19:21 mount: failed to do direct mount: invalid argument
      	[...]
      
      Change-Id: Ibfa2fa141cb43e1f8c7319233c454a3e85fa435e
      05c0aea6
    • Han-Wen Nienhuys's avatar
      Run gofmt -s -w globally · 0f41d79d
      Han-Wen Nienhuys authored
      Change-Id: I1aff29b88edff004f2b1cf7c36831c1767608b0d
      0f41d79d
  10. 27 Jan, 2023 1 commit
    • Jakob Unterwurzacher's avatar
      fuse: Increase MAX_KERNEL_WRITE to 1 MiB & enable CAP_MAX_PAGES · 265a3926
      Jakob Unterwurzacher authored
      Kernel 4.20 allows writes & reads up to 1 MiB (before: 128 kiB)
      via CAP_MAX_PAGES & MaxPages.
      
      Instead of exposing MaxPages in the API, we follow what libfuse
      does, and calculate MaxPages from MaxWrite (rounding up).
      
      Contrary to what libfuse does, we also set max_read to the same
      value as MaxWrite. This prevents reads getting larger than writes
      due to the rounding-up for MaxPages, which is unexpected. This
      also changes the default behavoir of go-fuse, which was 64 kiB
      writes, but 128 kiB for reads. Now it is 128 kiB for both.
      
      The tests are implemented in the fs package because it's
      easier there. They also test MaxReadAhead.
      
      Tested on Linux 4.19.0 and Linux 6.1.7 via all.bash,
      and on 6.1.7 also via the gocryptfs test suite.
      
      Supersedes https://github.com/hanwen/go-fuse/pull/347
      
      Change-Id: I5a1d4ee91945155c367888da7a90814a24a9ee6e
      265a3926
  11. 17 Nov, 2022 1 commit
    • Tamas Kerecsen's avatar
      Make ReadDirPlus configurable · 915cf541
      Tamas Kerecsen authored
      When ReadDirPlus is enabled, the FUSE fs has to gather a lot of additional data for every file even if it won't be used (for example when the user is doing and 'ls' or a large glob). This can cause performance problems, so it should be possible to switch to the simple ReadDir behavior for file systems where this is a bottleneck.
      
      Change-Id: I7f2e58fe6e728a408044ce789633423f6e527554
      915cf541
  12. 15 Nov, 2022 3 commits
    • Han-Wen Nienhuys's avatar
      all.bash: use /bin/bash explicitly · 9905e995
      Han-Wen Nienhuys authored
      Change-Id: If4af8e09d1921242e36a415317d390154c5c2891
      9905e995
    • Andrew Chambers's avatar
      fuse: Add release flag constants · 23b5d97d
      Andrew Chambers authored
      Change-Id: Icb2931139a6293abaaa95623a8e130dd6f8dab0b
      23b5d97d
    • sunjiapeng's avatar
      Fix sync.Pool leak · 4a0e6eb5
      sunjiapeng authored
      There is a sync.Pool leak in server.go, which triggers in case of
      multi-threaded loads.
      
      Benchmarks:
      
      env: Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz (8core 16procs)
      go test -bench="BenchmarkGoFuseRead" -benchmem
      
      old:
      
      2       10992 92501 ns/op 22671.71 MB/s 536981 B/op 196 allocs/op
      4       19068 57959 ns/op 36183.44 MB/s 151877 B/op 170 allocs/op
      8       27729 43796 ns/op 47884.39 MB/s 29068 B/op 162 allocs/op
      16      28674 41403 ns/op 50651.65 MB/s 6704 B/op 160 allocs/op
      
      fixed:
      
      2       23667 46589 ns/op 45014.20 MB/s 5357 B/op 167 allocs/op
      4       27753 42327 ns/op 49546.77 MB/s 4999 B/op 161 allocs/op
      8       29648 40806 ns/op 51392.81 MB/s 4904 B/op 160 allocs/op
      16      29389 40763 ns/op 51447.07 MB/s 4848 B/op 160 allocs/op
      
      Change-Id: I062928203df5603ebca04c08c4d428d385f99c2c
      4a0e6eb5
  13. 03 Oct, 2022 1 commit
  14. 22 Aug, 2022 1 commit
  15. 27 Jun, 2022 1 commit
    • Jille Timmermans's avatar
      Make OSXFUSE handle timeouts the same way as Linux · d01fda7e
      Jille Timmermans authored
      OSXFUSE applies a 60-second timeout for file operations. This
      is inconsistent with how FUSE works on Linux, where operations
      last as long as the daemon is willing to let them run.
      
      Change-Id: I6c042a3e785961a2c47c67e27d530bee5c50ce77
      d01fda7e
  16. 14 Jun, 2022 1 commit
  17. 31 May, 2022 1 commit
  18. 20 May, 2022 2 commits
    • Han-Wen Nienhuys's avatar
      unionfs: remove library · f4cec619
      Han-Wen Nienhuys authored
      This library was created as a mechanism to overlay a writable checkout
      for Git on top of Google's readonly SrcFS filesystem. This use case
      has long disappeared, and the unionfs library appears unused
      otherwise. Due to its reliance on timestamps and delays, it is very
      susceptible to flakiness in tests.
      
      Fixing this seems hard or maybe even impossible, so just remove the
      library.
      
      Change-Id: I6c594a724a0579b5c4c3aada76cd7013195fda94
      f4cec619
    • Han-Wen Nienhuys's avatar
      posixtest: provide more detail for failing ReadDir test · d8187fce
      Han-Wen Nienhuys authored
      Change-Id: I2b996ca3bfd1ea7e605e4dfd785cba2796340cd5
      d8187fce
  19. 12 Jan, 2022 1 commit
    • Jakob Unterwurzacher's avatar
      fuse: decode MKNOD result in debug output · f57e95bd
      Jakob Unterwurzacher authored
      MKNOD returns an EntryOut that we can decode.
      
      Before:
      
      20:27:39.722507 rx 24914: MKNOD n1 {010644 (022), 0} ["pipe"] 5b
      20:27:39.722546 tx 24914:     OK
      
      After:
      
      20: 32:39.156352 rx 38: MKNOD n1 {010644 (022), 0} ["pipe"] 5b
      20: 32:39.156389 tx 38:     OK, {n3 g1 tE=1s tA=1s {M010644 SZ=0 L=1 1027:1027 B0*4096 i0:46906 A 1641756759.155157 M 1641756759.155157 C 1641756759.155157}}
      Change-Id: If40e690219f20459466d7c8f9aa822c7186179dc
      f57e95bd
  20. 11 Jan, 2022 3 commits
    • Jakob Unterwurzacher's avatar
      fuse: fix mounting with MaxWrite < 8kiB · 81c1d52b
      Jakob Unterwurzacher authored
      The readPool size was calculated from MaxWrite not taking
      into account that the kernel fails all reads below 8 kiB.
      
      Fix that by always using at least 8kiB.
      
      Change-Id: I3bd9013be44b00bdc370bac00d00b4a106ec2d07
      81c1d52b
    • Jakob Unterwurzacher's avatar
      fuse: add MaxPages to INIT debug output · e1a5fd2a
      Jakob Unterwurzacher authored
      A later commit will allow setting MaxPages, so show it in the debug output.
      
      Also print MaxReadahead, MaxWrite, TimeGran in decimal instead of hex -
      these are neither bitfields nor addresses, so it seems clearer to have them in decimal.
      
      Before:
      
      22:03:50.020645 rx 2: INIT n0 {7.34 Ra 0x20000 PARALLEL_DIROPS,ASYNC_READ,EXPORT_SUPPORT,AUTO_INVAL_DATA,READDIRPLUS,NO_OPEN_SUPPORT,NO_OPENDIR_SUPPORT,EXPLICIT_INVAL_DATA,POSIX_LOCKS,DONT_MASK,SPLICE_READ,ASYNC_DIO,WRITEBACK_CACHE,HANDLE_KILLPRIV,CACHE_SYMLINKS,SPLICE_WRITE,SPLICE_MOVE,FLOCK_LOCKS,IOCTL_DIR,READDIRPLUS_AUTO,ABORT_ERROR,ATOMIC_O_TRUNC,BIG_WRITES,POSIX_ACL,MAX_PAGES,0x30000000}
      22:03:50.020665 tx 2:     OK, {7.28 Ra 0x20000 AUTO_INVAL_DATA,READDIRPLUS,NO_OPEN_SUPPORT,PARALLEL_DIROPS,ASYNC_READ,MAX_PAGES,BIG_WRITES 0/0 Wr 0x2000 Tg 0x0}
      
      After:
      
      22: 02:51.374635 rx 2: INIT n0 {7.34 Ra 131072 POSIX_LOCKS,ATOMIC_O_TRUNC,DONT_MASK,FLOCK_LOCKS,AUTO_INVAL_DATA,READDIRPLUS_AUTO,PARALLEL_DIROPS,MAX_PAGES,ASYNC_READ,EXPORT_SUPPORT,BIG_WRITES,SPLICE_WRITE,SPLICE_READ,HANDLE_KILLPRIV,WRITEBACK_CACHE,CACHE_SYMLINKS,NO_OPENDIR_SUPPORT,EXPLICIT_INVAL_DATA,SPLICE_MOVE,IOCTL_DIR,READDIRPLUS,ASYNC_DIO,NO_OPEN_SUPPORT,POSIX_ACL,ABORT_ERROR,0x30000000}
      22: 02:51.374656 tx 2:     OK, {7.28 Ra 131072 ASYNC_READ,BIG_WRITES,READDIRPLUS,NO_OPEN_SUPPORT,PARALLEL_DIROPS,AUTO_INVAL_DATA,MAX_PAGES 0/0 Wr 8192 Tg 0 MaxPages 2}
      Change-Id: Iea02ad3270615d019413b3306e8a8e7282cd7c52
      e1a5fd2a
    • hotaery's avatar
      fs: update oldParent.children for exchange rename · 91451a73
      hotaery authored
      Change-Id: I7b8d1a6be288324021c846273aceb08eb9010e98
      91451a73
  21. 04 Jan, 2022 1 commit
  22. 19 Dec, 2021 1 commit
    • Jakob Unterwurzacher's avatar
      fuse: prefer fusermount3 over fusermount; add debug output · 934a183e
      Jakob Unterwurzacher authored
      fusermount is (usually) from libfuse v2, and fusermount3 is from
      libfuse v3, which is the actively-developed version.
      
      Importantly, libfuse v3 added ExFAT to the list of filesystems
      that users are allowed to mount on, and libfuse v2 did not.
      
      The only ABI difference between fusermount and fusermount3 that
      I am aware of is that fusermount3 dropped the allow_empty option.
      
      Filesystems had to deal with that already, as fusermount may
      also be from libfuse v3, depending on what the distro does.
      
      This commit also adds two lines of debug output about which binary
      we actually call.
      
      Passes all.bash & the gocryptfs test suite.
      
      Fixes https://github.com/hanwen/go-fuse/issues/394
      Fixes https://github.com/rfjakob/gocryptfs/issues/626
      
      Change-Id: Id4574fb9c8d2c812a524181a76616159256d551c
      934a183e