1. 17 10月, 2006 1 次提交
    • M
      [PATCH] fuse: fix hang on SMP · 9ffbb916
      Miklos Szeredi 提交于
      Fuse didn't always call i_size_write() with i_mutex held which caused rare
      hangs on SMP/32bit.  This bug has been present since fuse-2.2, well before
      being merged into mainline.
      
      The simplest solution is to protect i_size_write() with the per-connection
      spinlock.  Using i_mutex for this purpose would require some restructuring of
      the code and I'm not even sure it's always safe to acquire i_mutex in all
      places i_size needs to be set.
      
      Since most of vmtruncate is already duplicated for other reasons, duplicate
      the remaining part as well, making all i_size_write() calls internal to fuse.
      
      Using i_size_write() was unnecessary in fuse_init_inode(), since this function
      is only called on a newly created locked inode.
      
      Reported by a few people over the years, but special thanks to Dana Henriksen
      who was persistent enough in helping me debug it.
      Signed-off-by: NMiklos Szeredi <miklos@szeredi.hu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      9ffbb916
  2. 30 9月, 2006 1 次提交
  3. 27 9月, 2006 1 次提交
  4. 01 8月, 2006 1 次提交
    • M
      [PATCH] fuse: use jiffies_64 · 0a0898cf
      Miklos Szeredi 提交于
      It is entirely possible (though rare) that jiffies half-wraps around, while a
      dentry/inode remains in the cache.  This could mean that the dentry/inode is
      not invalidated for another half wraparound-time.
      
      To get around this problem, use 64-bit jiffies.  The only problem with this is
      that dentry->d_time is 32 bits on 32-bit archs.  So use d_fsdata as the high
      32 bits.  This is an ugly hack, but far simpler, than having to allocate
      private data just for this purpose.
      
      Since 64-bit jiffies can be assumed never to wrap around, simple comparison
      can be used, and a zero time value can represent "invalid".
      Signed-off-by: NMiklos Szeredi <miklos@szeredi.hu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      0a0898cf
  5. 26 6月, 2006 5 次提交
  6. 23 6月, 2006 2 次提交
    • D
      [PATCH] VFS: Permit filesystem to perform statfs with a known root dentry · 726c3342
      David Howells 提交于
      Give the statfs superblock operation a dentry pointer rather than a superblock
      pointer.
      
      This complements the get_sb() patch.  That reduced the significance of
      sb->s_root, allowing NFS to place a fake root there.  However, NFS does
      require a dentry to use as a target for the statfs operation.  This permits
      the root in the vfsmount to be used instead.
      
      linux/mount.h has been added where necessary to make allyesconfig build
      successfully.
      
      Interest has also been expressed for use with the FUSE and XFS filesystems.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Acked-by: NAl Viro <viro@zeniv.linux.org.uk>
      Cc: Nathan Scott <nathans@sgi.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      726c3342
    • D
      [PATCH] VFS: Permit filesystem to override root dentry on mount · 454e2398
      David Howells 提交于
      Extend the get_sb() filesystem operation to take an extra argument that
      permits the VFS to pass in the target vfsmount that defines the mountpoint.
      
      The filesystem is then required to manually set the superblock and root dentry
      pointers.  For most filesystems, this should be done with simple_set_mnt()
      which will set the superblock pointer and then set the root dentry to the
      superblock's s_root (as per the old default behaviour).
      
      The get_sb() op now returns an integer as there's now no need to return the
      superblock pointer.
      
      This patch permits a superblock to be implicitly shared amongst several mount
      points, such as can be done with NFS to avoid potential inode aliasing.  In
      such a case, simple_set_mnt() would not be called, and instead the mnt_root
      and mnt_sb would be set directly.
      
      The patch also makes the following changes:
      
       (*) the get_sb_*() convenience functions in the core kernel now take a vfsmount
           pointer argument and return an integer, so most filesystems have to change
           very little.
      
       (*) If one of the convenience function is not used, then get_sb() should
           normally call simple_set_mnt() to instantiate the vfsmount. This will
           always return 0, and so can be tail-called from get_sb().
      
       (*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the
           dcache upon superblock destruction rather than shrink_dcache_anon().
      
           This is required because the superblock may now have multiple trees that
           aren't actually bound to s_root, but that still need to be cleaned up. The
           currently called functions assume that the whole tree is rooted at s_root,
           and that anonymous dentries are not the roots of trees which results in
           dentries being left unculled.
      
           However, with the way NFS superblock sharing are currently set to be
           implemented, these assumptions are violated: the root of the filesystem is
           simply a dummy dentry and inode (the real inode for '/' may well be
           inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries
           with child trees.
      
           [*] Anonymous until discovered from another tree.
      
       (*) The documentation has been adjusted, including the additional bit of
           changing ext2_* into foo_* in the documentation.
      
      [akpm@osdl.org: convert ipath_fs, do other stuff]
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Acked-by: NAl Viro <viro@zeniv.linux.org.uk>
      Cc: Nathan Scott <nathans@sgi.com>
      Cc: Roland Dreier <rolandd@cisco.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      454e2398
  7. 09 6月, 2006 1 次提交
  8. 26 4月, 2006 2 次提交
  9. 12 4月, 2006 1 次提交
    • M
      [fuse] fix deadlock between fuse_put_super() and request_end() · 73ce8355
      Miklos Szeredi 提交于
      A deadlock was possible, when the last reference to the superblock was
      held due to a background request containing a file reference.
      
      Releasing the file would release the vfsmount which in turn would
      release the superblock.  Since sbput_sem is held during the fput() and
      fuse_put_super() tries to acquire this same semaphore, a deadlock
      results.
      
      The chosen soltuion is to get rid of sbput_sem, and instead use the
      spinlock to ensure the referenced inodes/file are released only once.
      Since the actual release may sleep, defer these outside the locked
      region, but using local variables instead of the structure members.
      
      This is a much more rubust solution.
      Signed-off-by: NMiklos Szeredi <miklos@szeredi.hu>
      73ce8355
  10. 11 4月, 2006 5 次提交
    • M
      [PATCH] fuse: account background requests · 08a53cdc
      Miklos Szeredi 提交于
      The previous patch removed limiting the number of outstanding requests.  This
      patch adds a much simpler limiting, that is also compatible with file locking
      operations.
      
      A task may have at most one synchronous request allocated.  So these requests
      need not be otherwise limited.
      
      However the number of background requests (release, forget, asynchronous
      reads, interrupted requests) can grow indefinitely.  This can be used by a
      malicous user to cause FUSE to allocate arbitrary amounts of unswappable
      kernel memory, denying service.
      
      For this reason add a limit for the number of background requests, and block
      allocations of new requests until the number goes bellow the limit.
      
      Also use this mechanism to block all requests until the INIT reply is
      received.
      Signed-off-by: NMiklos Szeredi <miklos@szeredi.hu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      08a53cdc
    • M
      [PATCH] fuse: clean up request accounting · ce1d5a49
      Miklos Szeredi 提交于
      FUSE allocated most requests from a fixed size pool filled at mount time.
      However in some cases (release/forget) non-pool requests were used.  File
      locking operations aren't well served by the request pool, since they may
      block indefinetly thus exhausting the pool.
      
      This patch removes the request pool and always allocates requests on demand.
      Signed-off-by: NMiklos Szeredi <miklos@szeredi.hu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      ce1d5a49
    • M
      [PATCH] fuse: use a per-mount spinlock · d7133114
      Miklos Szeredi 提交于
      Remove the global spinlock in favor of a per-mount one.
      
      This patch is basically find & replace.  The difficult part has already been
      done by the previous patch.
      Signed-off-by: NMiklos Szeredi <miklos@szeredi.hu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      d7133114
    • M
      [PATCH] fuse: simplify locking · 0720b315
      Miklos Szeredi 提交于
      This is in preparation for removing the global spinlock in favor of a
      per-mount one.
      
      The only critical part is the interaction between fuse_dev_release() and
      fuse_fill_super(): fuse_dev_release() must see the assignment to
      file->private_data, otherwise it will leak the reference to fuse_conn.
      
      This is ensured by the fput() operation, which will synchronize the assignment
      with other CPU's that may do a final fput() soon after this.
      
      Also redundant locking is removed from fuse_fill_super(), where exclusion is
      already ensured by the BKL held for this function by the VFS.
      Signed-off-by: NMiklos Szeredi <miklos@szeredi.hu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      0720b315
    • J
      [PATCH] fuse: add O_ASYNC support to FUSE device · 385a17bf
      Jeff Dike 提交于
      This adds asynchronous notification to FUSE - a FUSE server can request
      O_ASYNC on a /dev/fuse file descriptor and receive SIGIO when there is input
      available.
      
      One subtlety - fuse_dev_fasync, which is called when O_ASYNC is requested,
      does no locking, unlink the other methods.  I think it's unnecessary, as the
      fuse_conn.fasync list is manipulated only by fasync_helper and kill_fasync,
      which provide their own locking.  It would also be wrong to use the fuse_lock,
      as it's a spin lock and fasync_helper can sleep.  My one concern with this is
      the fuse_conn going away underneath fuse_dev_fasync - sys_fcntl takes a
      reference on the file struct, so this seems not to be a problem.
      Signed-off-by: NJeff Dike <jdike@addtoit.com>
      Signed-off-by: NMiklos Szeredi <miklos@szeredi.hu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      385a17bf
  11. 02 2月, 2006 1 次提交
    • M
      [PATCH] fuse: fix async read for legacy filesystems · 9cd68455
      Miklos Szeredi 提交于
      While asynchronous reads mean a performance improvement in most cases, if
      the filesystem assumed that reads are synchronous, then async reads may
      degrade performance (filesystem may receive reads out of order, which can
      confuse it's own readahead logic).
      
      With sshfs a 1.5 to 4 times slowdown can be measured.
      
      There's also a need for userspace filesystems to know whether asynchronous
      reads are supported by the kernel or not.
      
      To achive these, negotiate in the INIT request whether async reads will be
      used and the maximum readahead value.  Update interface version to 7.6
      
      If userspace uses a version earlier than 7.6, then disable async reads, and
      set maximum readahead value to the maximum read size, as done in previous
      versions.
      Signed-off-by: NMiklos Szeredi <miklos@szeredi.hu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      9cd68455
  12. 17 1月, 2006 8 次提交
  13. 07 1月, 2006 4 次提交
  14. 10 9月, 2005 7 次提交