1. 13 Dec, 2011 7 commits
    • John Muir's avatar
      FUSE: Notifying the kernel of deletion. · 451d0f59
      John Muir authored
      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: default avatarJohn Muir <john@jmuir.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      451d0f59
    • Miklos Szeredi's avatar
      fuse: support ioctl on directories · b18da0c5
      Miklos Szeredi authored
      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: default avatarAntonio SJ Musumeci <bile@landofbile.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      b18da0c5
    • Thomas Meyer's avatar
      fuse: Use kcalloc instead of kzalloc to allocate array · c411cc88
      Thomas Meyer authored
      The advantage of kcalloc is, that will prevent integer overflows which could
      result from the multiplication of number of elements and size and it is also
      a bit nicer to read.
      
      The semantic patch that makes this change is available
      in https://lkml.org/lkml/2011/11/25/107Signed-off-by: default avatarThomas Meyer <thomas@m3y3r.de>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      c411cc88
    • Miklos Szeredi's avatar
      fuse: llseek optimize SEEK_CUR and SEEK_SET · c07c3d19
      Miklos Szeredi authored
      Use generic_file_llseek() instead of open coding the seek function.
      
      i_mutex protection is only necessary for SEEK_END (and SEEK_HOLE, SEEK_DATA), so
      move SEEK_CUR and SEEK_SET out from under i_mutex.
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      c07c3d19
    • Miklos Szeredi's avatar
      fuse: llseek fix race · 73104b6e
      Miklos Szeredi authored
      Fix race between lseek(fd, 0, SEEK_CUR) and read/write.  This was fixed in
      generic code by commit 5b6f1eb9 (vfs: lseek(fd, 0, SEEK_CUR) race condition).
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      73104b6e
    • Roel Kluin's avatar
      fuse: fix llseek bug · b48c6af2
      Roel Kluin authored
      The test in fuse_file_llseek() "not SEEK_CUR or not SEEK_SET" always evaluates
      to true.
      
      This was introduced in 3.1 by commit 06222e49 (fs: handle SEEK_HOLE/SEEK_DATA
      properly in all fs's that define their own llseek) and changed the behavior of
      SEEK_CUR and SEEK_SET to always retrieve the file attributes.  This is a
      performance regression.
      
      Fix the test so that it makes sense.
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      CC: stable@vger.kernel.org
      CC: Josef Bacik <josef@redhat.com>
      CC: Al Viro <viro@zeniv.linux.org.uk>
      b48c6af2
    • Miklos Szeredi's avatar
      fuse: fix fuse_retrieve · 48706d0a
      Miklos Szeredi authored
      Fix two bugs in fuse_retrieve():
      
       - retrieving more than one page would yield repeated instances of the
         first page
      
       - if more than FUSE_MAX_PAGES_PER_REQ pages were requested than the
         request page array would overflow
      
      fuse_retrieve() was added in 2.6.36 and these bugs had been there since the
      beginning.
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      CC: stable@vger.kernel.org
      48706d0a
  2. 09 Dec, 2011 33 commits