1. 24 1月, 2013 2 次提交
    • M
      fuse: categorize fuse_get_req() · b111c8c0
      Maxim Patlasov 提交于
      The patch categorizes all fuse_get_req() invocations into two categories:
       - fuse_get_req_nopages(fc) - when caller doesn't care about req->pages
       - fuse_get_req(fc, n) - when caller need n page pointers (n > 0)
      
      Adding fuse_get_req_nopages() helps to avoid numerous fuse_get_req(fc, 0)
      scattered over code. Now it's clear from the first glance when a caller need
      fuse_req with page pointers.
      
      The patch doesn't make any logic changes. In multi-page case, it silly
      allocates array of FUSE_MAX_PAGES_PER_REQ page pointers. This will be amended
      by future patches.
      Signed-off-by: NMaxim Patlasov <mpatlasov@parallels.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@suse.cz>
      b111c8c0
    • A
      fuse: implement NFS-like readdirplus support · 0b05b183
      Anand V. Avati 提交于
      This patch implements readdirplus support in FUSE, similar to NFS.
      The payload returned in the readdirplus call contains
      'fuse_entry_out' structure thereby providing all the necessary inputs
      for 'faking' a lookup() operation on the spot.
      
      If the dentry and inode already existed (for e.g. in a re-run of ls -l)
      then just the inode attributes timeout and dentry timeout are refreshed.
      
      With a simple client->network->server implementation of a FUSE based
      filesystem, the following performance observations were made:
      
      Test: Performing a filesystem crawl over 20,000 files with
      
      sh# time ls -lR /mnt
      
      Without readdirplus:
      Run 1: 18.1s
      Run 2: 16.0s
      Run 3: 16.2s
      
      With readdirplus:
      Run 1: 4.1s
      Run 2: 3.8s
      Run 3: 3.8s
      
      The performance improvement is significant as it avoided 20,000 upcalls
      calls (lookup). Cache consistency is no worse than what already is.
      Signed-off-by: NAnand V. Avati <avati@redhat.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@suse.cz>
      0b05b183
  2. 15 11月, 2012 1 次提交
    • E
      userns: Support fuse interacting with multiple user namespaces · 499dcf20
      Eric W. Biederman 提交于
      Use kuid_t and kgid_t in struct fuse_conn and struct fuse_mount_data.
      
      The connection between between a fuse filesystem and a fuse daemon is
      established when a fuse filesystem is mounted and provided with a file
      descriptor the fuse daemon created by opening /dev/fuse.
      
      For now restrict the communication of uids and gids between the fuse
      filesystem and the fuse daemon to the initial user namespace.  Enforce
      this by verifying the file descriptor passed to the mount of fuse was
      opened in the initial user namespace.  Ensuring the mount happens in
      the initial user namespace is not necessary as mounts from non-initial
      user namespaces are not yet allowed.
      
      In fuse_req_init_context convert the currrent fsuid and fsgid into the
      initial user namespace for the request that will be sent to the fuse
      daemon.
      
      In fuse_fill_attr convert the uid and gid passed from the fuse daemon
      from the initial user namespace into kuids and kgids.
      
      In iattr_to_fattr called from fuse_setattr convert kuids and kgids
      into the uids and gids in the initial user namespace before passing
      them to the fuse filesystem.
      
      In fuse_change_attributes_common called from fuse_dentry_revalidate,
      fuse_permission, fuse_geattr, and fuse_setattr, and fuse_iget convert
      the uid and gid from the fuse daemon into a kuid and a kgid to store
      on the fuse inode.
      
      By default fuse mounts are restricted to task whose uid, suid, and
      euid matches the fuse user_id and whose gid, sgid, and egid matches
      the fuse group id.  Convert the user_id and group_id mount options
      into kuids and kgids at mount time, and use uid_eq and gid_eq to
      compare the in fuse_allow_task.
      
      Cc: Miklos Szeredi <miklos@szeredi.hu>
      Acked-by: NSerge Hallyn <serge.hallyn@canonical.com>
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      499dcf20
  3. 15 8月, 2012 1 次提交
  4. 14 7月, 2012 9 次提交
  5. 14 5月, 2012 2 次提交
  6. 05 3月, 2012 2 次提交
    • A
      fuse: O_DIRECT support for files · 4273b793
      Anand Avati 提交于
      Implement ->direct_IO() method in aops. The ->direct_IO() method combines
      the existing fuse_direct_read/fuse_direct_write methods to implement
      O_DIRECT functionality.
      
      Reaching ->direct_IO() in the read path via generic_file_aio_read ensures
      proper synchronization with page cache with its existing framework.
      
      Reaching ->direct_IO() in the write path via fuse_file_aio_write is made
      to come via generic_file_direct_write() which makes it play nice with
      the page cache w.r.t other mmap pages etc.
      
      On files marked 'direct_io' by the filesystem server, IO always follows
      the fuse_direct_read/write path. There is no effect of fcntl(O_DIRECT)
      and it always succeeds.
      
      On files not marked with 'direct_io' by the filesystem server, the IO
      path depends on O_DIRECT flag by the application. This can be passed
      at the time of open() as well as via fcntl().
      
      Note that asynchronous O_DIRECT iocb jobs are completed synchronously
      always (this has been the case with FUSE even before this patch)
      Signed-off-by: NAnand Avati <avati@redhat.com>
      Reviewed-by: NJeff Moyer <jmoyer@redhat.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@suse.cz>
      4273b793
    • M
      fuse: fix nlink after unlink · ac45d613
      Miklos Szeredi 提交于
      Anand Avati reports that the following sequence of system calls fail on a fuse
      filesystem:
      
      
       	create("filename") => 0
       	link("filename", "linkname") => 0
       	unlink("filename") => 0
       	link("linkname", "filename") => -ENOENT ### BUG ###
      
      vfs_link() fails with ENOENT if i_nlink is zero, this is done to prevent
      resurrecting already deleted files.
      
      Fuse clears i_nlink on unlink even if there are other links pointing to the
      file.
      Reported-by: NAnand Avati <avati@redhat.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@suse.cz>
      ac45d613
  7. 04 1月, 2012 4 次提交
  8. 13 12月, 2011 2 次提交
    • J
      FUSE: Notifying the kernel of deletion. · 451d0f59
      John Muir 提交于
      Allows a FUSE file-system to tell the kernel when a file or directory is
      deleted. If the specified dentry has the specified inode number, the kernel will
      unhash it.
      
      The current 'fuse_notify_inval_entry' does not cause the kernel to clean up
      directories that are in use properly, and as a result the users of those
      directories see incorrect semantics from the file-system. The error condition
      seen when 'fuse_notify_inval_entry' is used to notify of a deleted directory is
      avoided when 'fuse_notify_delete' is used instead.
      
      The following scenario demonstrates the difference:
      1. User A chdirs into 'testdir' and starts reading 'testfile'.
      2. User B rm -rf 'testdir'.
      3. User B creates 'testdir'.
      4. User C chdirs into 'testdir'.
      
      If you run the above within the same machine on any file-system (including fuse
      file-systems), there is no problem: user C is able to chdir into the new
      testdir. The old testdir is removed from the dentry tree, but still open by user
      A.
      
      If operations 2 and 3 are performed via the network such that the fuse
      file-system uses one of the notify functions to tell the kernel that the nodes
      are gone, then the following error occurs for user C while user A holds the
      original directory open:
      
      muirj@empacher:~> ls /test/testdir
      ls: cannot access /test/testdir: No such file or directory
      
      The issue here is that the kernel still has a dentry for testdir, and so it is
      requesting the attributes for the old directory, while the file-system is
      responding that the directory no longer exists.
      
      If on the other hand, if the file-system can notify the kernel that the
      directory is deleted using the new 'fuse_notify_delete' function, then the above
      ls will find the new directory as expected.
      Signed-off-by: NJohn Muir <john@jmuir.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@suse.cz>
      451d0f59
    • M
      fuse: support ioctl on directories · b18da0c5
      Miklos Szeredi 提交于
      Multiplexing filesystems may want to support ioctls on the underlying
      files and directores (e.g. FS_IOC_{GET,SET}FLAGS).
      
      Ioctl support on directories was missing so add it now.
      Reported-by: NAntonio SJ Musumeci <bile@landofbile.com>
      Signed-off-by: NMiklos Szeredi <mszeredi@suse.cz>
      b18da0c5
  9. 21 7月, 2011 1 次提交
    • J
      fs: push i_mutex and filemap_write_and_wait down into ->fsync() handlers · 02c24a82
      Josef Bacik 提交于
      Btrfs needs to be able to control how filemap_write_and_wait_range() is called
      in fsync to make it less of a painful operation, so push down taking i_mutex and
      the calling of filemap_write_and_wait() down into the ->fsync() handlers.  Some
      file systems can drop taking the i_mutex altogether it seems, like ext3 and
      ocfs2.  For correctness sake I just pushed everything down in all cases to make
      sure that we keep the current behavior the same for everybody, and then each
      individual fs maintainer can make up their mind about what to do from there.
      Thanks,
      Acked-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NJosef Bacik <josef@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      02c24a82
  10. 20 7月, 2011 5 次提交
  11. 28 5月, 2011 1 次提交
  12. 26 5月, 2011 2 次提交
  13. 10 5月, 2011 1 次提交
  14. 21 3月, 2011 2 次提交
  15. 10 3月, 2011 1 次提交
  16. 25 2月, 2011 1 次提交
    • M
      fuse: fix truncate after open · 8d56addd
      Miklos Szeredi 提交于
      Commit e1181ee6 "vfs: pass struct file to do_truncate on O_TRUNC
      opens" broke the behavior of open(O_TRUNC|O_RDONLY) in fuse.  Fuse
      assumed that when called from open, a truncate() will be done, not an
      ftruncate().
      
      Fix by restoring the old behavior, based on the ATTR_OPEN flag.
      Signed-off-by: NMiklos Szeredi <mszeredi@suse.cz>
      8d56addd
  17. 13 1月, 2011 1 次提交
  18. 07 1月, 2011 2 次提交