1. 13 Nov, 2017 1 commit
    • Jakob Unterwurzacher's avatar
      pathfs: simplify pathInode.GetAttr · 66de2f17
      Jakob Unterwurzacher authored
      The function was written with only a single return at
      the end, which was elegant, but harder to follow.
      
      Add early returns to handle common cases and add a few
      comments.
      
      A functional change is that we now catch when we get
      OK with fi == nil and return EINVAL and log a message.
      This should not happen and is a bug in the filesystem
      implementation.
      
      Passes ./all.bash and the gocryptfs test suite.
      66de2f17
  2. 07 Nov, 2017 2 commits
  3. 20 Oct, 2017 1 commit
  4. 19 Oct, 2017 3 commits
  5. 09 Oct, 2017 1 commit
    • Jakob Unterwurzacher's avatar
      debug output: fix blank line after READDIRPLUS · cfefa3d5
      Jakob Unterwurzacher authored
      Trivial patch that fixes a blank line in the debug output.
      
      Before:
      
        2017/10/03 20:25:56 Dispatch 602: READDIRPLUS, NodeId: 1. data: {Fh 2 off 0 sz 4096  L 0 DIRECTORY,NONBLOCK,0x8000}
        2017/10/03 20:25:56 Serialize 602: READDIRPLUS code: OK value:  832 bytes data
      
        2017/10/03 20:25:56 Dispatch 603: GETXATTR, NodeId: 7. data: {sz 0} names: [system.posix_acl_access] 24 bytes
        2017/10/03 20:25:56 Serialize 603: GETXATTR code: 61=no data available value:
      
      After:
      
        2017/10/03 21:02:46 Dispatch 22: READDIRPLUS, NodeId: 1. data: {Fh 2 off 0 sz 4096  L 0 RDONLY,0x8000}
        2017/10/03 21:02:46 Serialize 22: READDIRPLUS code: OK value:  648 bytes data
        2017/10/03 21:02:46 Dispatch 23: READDIRPLUS, NodeId: 1. data: {Fh 2 off 4 sz 4096  L 0 RDONLY,0x8000}
        2017/10/03 21:02:46 Serialize 23: READDIRPLUS code: OK value:
      cfefa3d5
  6. 11 Sep, 2017 1 commit
  7. 03 Sep, 2017 1 commit
  8. 08 Aug, 2017 1 commit
    • Jakob Unterwurzacher's avatar
      fuse, loopback: return actual inode numbers from READDIR · 204b45db
      Jakob Unterwurzacher authored
      When an app in a FUSE mount calls getdents(2), go-fuse receives
      READDIR[PLUS] and calls the filesystem's OpenDir function that
      returns []DirEntry.
      
      The data returned from getdents(2) contains an inode number for
      each directory entry, "d_ino". Until now, struct DirEntry had no
      corresponding field and the value passed to the kernel was always
      FUSE_UNKNOWN_INO = 0xffffffff
      
      This broke apps that actually look at the d_ino field, like
      "find -inum".
      
      This commit adds the "Ino" filed to struct DirEntry. If the field
      is not set by the filesystem, it is set to FUSE_UNKNOWN_INO,
      as before. Otherwise it is left alone and passed to the kernel.
      
      loopbackFileSystem's OpenDir function is extended to set the inode
      number. A test verifies that the returned inode number is sane.
      
      Fixes https://github.com/hanwen/go-fuse/issues/175
      204b45db
  9. 28 Jul, 2017 1 commit
  10. 18 Jul, 2017 3 commits
  11. 17 Jul, 2017 1 commit
  12. 15 Jul, 2017 6 commits
    • Han-Wen Nienhuys's avatar
      b4cc1627
    • Han-Wen Nienhuys's avatar
      Disable flock tests. · 6416abc3
      Han-Wen Nienhuys authored
      The locking code is not hooked in the fuse/ server code, so this
      just exercises the kernel's default locking implementation.
      6416abc3
    • Han-Wen Nienhuys's avatar
      fuse/pathfs: don't take pathLock in GetPath() · 68f32f6d
      Han-Wen Nienhuys authored
      The parent tracking moved into nodefs in
      commit 0107672a, so there is no need for
      taking that lock anymore.
      68f32f6d
    • Han-Wen Nienhuys's avatar
      96a198bf
    • Han-Wen Nienhuys's avatar
      fuse: fix tests for Go 1.9 · 4f10e248
      Han-Wen Nienhuys authored
      Go 1.9 uses epoll() for more efficient file I/O. File I/O causes a
      call to epoll, and the runtime makes this call take up a GOMAXPROCS
      slot.
      
      The FUSE kernel module also supports poll: polling on a file residing
      in a FUSE file system causes the kernel to sends a POLL request to the
      userspace process.  If the process responds with ENOSYS, the kernel
      will stop forwarding poll requests to the FUSE process.
      
      In a test for Go FUSE file systems, it is normal to serve the
      filesystem out of the same process that opens files in the file
      system. If this happens in Go 1.9, the epoll call can take the only
      GOMAXPROCS slot left, leaving the process unable to respond to the
      FUSE POLL opcode, deadlocking the process.
      
      This change add support for a magic file "/ .go-fuse-epoll-hack" with
      node ID uint64(-1), and on starting up the file system, the library
      calls poll() on this file, triggering the POLL opcode before the Go
      runtime had a chance to do so.
      
      There are two problem scenarios left:
      
      * File system tests that start I/O before calling WaitMount() still
        risk deadlocking themselves.
      
      * The Linux kernel keeps track of feature support in fuse_conn, which notes
      
               * The following bitfields are only for optimization purposes
               * and hence races in setting them will not cause malfunction
      
        if our forced ENOSYS gets lost due to a race condition in the
        kernel, this can still trigger.
      
      Fixes golang/go#21014 and #165
      4f10e248
    • Han-Wen Nienhuys's avatar
  13. 13 Jul, 2017 1 commit
    • Han-Wen Nienhuys's avatar
      splice: use syscall directly for splice I/O · a8bec8ce
      Han-Wen Nienhuys authored
      This avoids involving the go 1.9 poller in I/O, which causes hangs, as
      the poller does not understand the fcntl(O_NONBLOCK) tweak that we
      executed on the pipe's file descriptors.
      
      Fixes #164
      a8bec8ce
  14. 11 Jul, 2017 1 commit
    • Shayan Pooya's avatar
      Do not fork a new process to unmount if user is privileged · c878ca45
      Shayan Pooya authored
      The root user can issue the umount syscall and does not need the
      fusermount binary. Therefore, it is not necessary to fork and exec a new
      process just to run the umount binary.
      
      Golang has a global lock held for forking (See exec_unix.go in the golang
      source tree):
      "Acquire the fork lock so that no other threads create new fds that are
      not yet close-on-exec before we fork."
      
      So it would be best if processes would refrain from forking
      unnecessarily.
      Signed-off-by: default avatarShayan Pooya <shayan@arista.com>
      c878ca45
  15. 09 Jun, 2017 2 commits
  16. 24 Apr, 2017 1 commit
    • Jeff Hodges's avatar
      fix first unionfs test datarace · 5404bf0e
      Jeff Hodges authored
      This first race was easy to find and fix in the tests themselves.
      
      It exposes another race in nodefs.FileSystemConnector where a node's
      mount (and therefore, treeLock) is is not the same as the grand-parent
      node's is.
      
      Updates #138.
      5404bf0e
  17. 19 Apr, 2017 1 commit
  18. 14 Mar, 2017 1 commit
  19. 10 Mar, 2017 3 commits
  20. 21 Dec, 2016 2 commits
  21. 03 Nov, 2016 1 commit
  22. 02 Nov, 2016 3 commits
    • Han-Wen Nienhuys's avatar
      Rename test file. · f4003c9b
      Han-Wen Nienhuys authored
      Fixes #127.
      f4003c9b
    • Jonathon Reinhart's avatar
      nodefs: Change defaultNode.GetAttr() to call file.GetAttr() if not nil · 994fc0fe
      Jonathon Reinhart authored
      This enhances nodes which embed defaultNode (which is most of them),
      allowing those implementations to omit a GetAttr() method. Without this,
      when the kernel calls GetAttr() for an open file, FUSE will return a
      size of zero, causing a read() of the file to always return 0, even
      though fuse returns a nonzero number of bytes.
      
      One can leverage this behavior to create a Linux procfs-like file, which
      stat shows to be zero bytes, but can be successfully read.
      
      N.B. This behavior is only useful if the FileSystemConnector Options
      specify AttrTimeout of zero. Otherwise, the result of the first call to
      GetAttr() (file == nil) is cached, and the kernel allows zero bytes to
      be read. With this caching disabled, the next GetAttr() call (file !=
      nil) will be used to control the number of readable bytes.
      994fc0fe
    • Han-Wen Nienhuys's avatar
      a2e4f919
  23. 24 Oct, 2016 1 commit
  24. 18 Oct, 2016 1 commit