17 Oct, 2007

6 commits

  • Don't return -ENOENT for a read() on the fuse device when the request was
    aborted. Instead return -ENODEV, meaning the filesystem has been
    force-umounted or aborted.

    Previously ENOENT meant that the request was interrupted, but now the
    'aborted' flag is not set in case of interrupts.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • Don't set 'aborted' flag on a request if it's interrupted. We have to wait
    for the answer anyway, and this would only a very little time while copying
    the reply.

    This means, that write() on the fuse device will not return -ENOENT during
    normal operation, only if the filesystem is aborted by a forced umount or
    through the fusectl interface.

    This could simplify userspace code somewhat when backward compatibility with
    earlier kernel versions is not required.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • Move dput/mntput pair from request_end() to fuse_release_end(), because
    there's no other place they are used.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • Make lifetime of 'struct fuse_file' independent from 'struct file' by adding a
    reference counter and destructor.

    This will enable asynchronous page writeback, where it cannot be guaranteed,
    that the file is not released while a request with this file handle is being
    served.

    The actual RELEASE request is only sent when there are no more references to
    the fuse_file.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • Use wake_up_all instead of wake_up in put_reserved_req(), otherwise it is
    possible that the right task is not woken up.

    Also create a separate reserved_req_waitq in addition to the blocked_waitq,
    since they fulfill totally separate functions.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • Set the read and write congestion state if the request queue is close to
    blocking, and clear it when it's not.

    This prevents unnecessary blocking in readahead and (when writable mmaps are
    allowed) writeback.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     

20 Jul, 2007

1 commit

  • Slab destructors were no longer supported after Christoph's
    c59def9f222d44bb7e2f0a559f2906191a0862d7 change. They've been
    BUGs for both slab and slub, and slob never supported them
    either.

    This rips out support for the dtor pointer from kmem_cache_create()
    completely and fixes up every single callsite in the kernel (there were
    about 224, not including the slab allocator definitions themselves,
    or the documentation references).

    Signed-off-by: Paul Mundt

    Paul Mundt
     

08 Dec, 2006

2 commits

  • Replace all uses of kmem_cache_t with struct kmem_cache.

    The patch was generated using the following script:

    #!/bin/sh
    #
    # Replace one string by another in all the kernel sources.
    #

    set -e

    for file in `find * -name "*.c" -o -name "*.h"|xargs grep -l $1`; do
    quilt add $file
    sed -e "1,\$s/$1/$2/g" $file >/tmp/$$
    mv /tmp/$$ $file
    quilt refresh
    done

    The script was run like this

    sh replace kmem_cache_t "struct kmem_cache"

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     
  • SLAB_KERNEL is an alias of GFP_KERNEL.

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     

01 Oct, 2006

1 commit


30 Sep, 2006

1 commit


26 Jun, 2006

5 commits

  • Add synchronous request interruption. This is needed for file locking
    operations which have to be interruptible. However filesystem may implement
    interruptibility of other operations (e.g. like NFS 'intr' mount option).

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • Rename the 'interrupted' flag to 'aborted', since it indicates exactly that,
    and next patch will introduce an 'interrupted' flag for a

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • All POSIX locks owned by the current task are removed on close(). If the
    FLUSH request resulting initiated by close() fails to reach userspace, there
    might be locks remaining, which cannot be removed.

    The only reason it could fail, is if allocating the request fails. In this
    case use the request reserved for RELEASE, or if that is currently used by
    another FLUSH, wait for it to become available.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • Add a control filesystem to fuse, replacing the attributes currently exported
    through sysfs. An empty directory '/sys/fs/fuse/connections' is still created
    in sysfs, and mounting the control filesystem here provides backward
    compatibility.

    Advantages of the control filesystem over the previous solution:

    - allows the object directory and the attributes to be owned by the
    filesystem owner, hence letting unpriviled users abort the
    filesystem connection

    - does not suffer from module unload race

    [akpm@osdl.org: fix this fs for recent dhowells depredations]
    [akpm@osdl.org: fix 64-bit printk warnings]
    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • Don't put requests into the background when a fatal interrupt occurs while the
    request is in userspace. This removes a major wart from the implementation.

    Backgrounding of requests was introduced to allow breaking of deadlocks.
    However now the same can be achieved by aborting the filesystem through the
    'abort' sysfs attribute.

    This is a change in the interface, but should not cause problems, since these
    kinds of deadlocks never happen during normal operation.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     

26 Apr, 2006

2 commits

  • 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 solution is to move the fput() outside the region protected by
    sbput_sem.

    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • This reverts 73ce8355c243a434524a34c05cc417dd0467996e commit.

    It was wrong, because it didn't take into account the requirement,
    that iput() for background requests must be performed synchronously
    with ->put_super(), otherwise active inodes may remain after unmount.

    The right solution is to keep the sbput_sem and perform iput() within
    the locked region, but move fput() outside sbput_sem.

    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     

12 Apr, 2006

3 commits

  • Request is already initialized in fuse_request_alloc() so no need to
    do it again in fuse_get_req().

    Signed-off-by: Miklos Szeredi

    Miklos Szeredi
     
  • Properly accounting the number of waiting requests was forgotten in
    "clean up request accounting" patch.

    Signed-off-by: Miklos Szeredi

    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: Miklos Szeredi

    Miklos Szeredi
     

11 Apr, 2006

8 commits

  • 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: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    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: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • Return consistent error values for the case when the opened device file has no
    mount associated yet.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    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: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    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: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • I don't like duplicating the connected and list_empty tests in fuse_dev_readv,
    but this seemed cleaner than adding the f_flags test to request_wait.

    Signed-off-by: Jeff Dike
    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    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: Jeff Dike
    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jeff Dike
     
  • fuse_dev_poll() returned an error value instead of a poll mask. Luckily (or
    unluckily) -ENODEV does contain the POLLERR bit.

    There's also a race if filesystem is unmounted between fuse_get_conn() and
    spin_lock(), in which case this event will be missed by poll().

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     

29 Mar, 2006

1 commit

  • This is a conversion to make the various file_operations structs in fs/
    const. Basically a regexp job, with a few manual fixups

    The goal is both to increase correctness (harder to accidentally write to
    shared datastructures) and reducing the false sharing of cachelines with
    things that get dirty in .data (while .rodata is nicely read only and thus
    cache clean)

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arjan van de Ven
     

18 Feb, 2006

1 commit

  • There's a rather theoretical case of the BUG triggering in
    fuse_reset_request():

    - iget() fails because of OOM after a successful CREATE_OPEN request
    - during IO on the resulting RELEASE request the connection is aborted

    Fix and add warning to fuse_reset_request().

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     

06 Feb, 2006

1 commit


17 Jan, 2006

8 commits

  • Now the INIT requests can be completely handled in inode.c and the
    fuse_send_init() function need not be global any more.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • Add possibility for requests to run asynchronously and call an 'end' callback
    when finished.

    With this, the special handling of the INIT and RELEASE requests can be
    cleaned up too.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • Add ability to abort a filesystem connection.

    With the introduction of asynchronous reads, the ability to interrupt any
    request is not enough to dissolve deadlocks, since now waiting for the request
    completion (page unlocked) is independent of the actual request, so in a
    deadlock all threads will be uninterruptible.

    The solution is to make it possible to abort all requests, even those
    currently undergoing I/O to/from userspace. The natural interface for this is
    'mount -f mountpoint', but that only works as long as the filesystem is
    attached. So also add an 'abort' attribute to the sysfs view of the
    connection.

    Signed-off-by: Miklos Szeredi
    Cc: Greg KH
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • This patch adds the 'waiting' attribute which indicates how many filesystem
    requests are currently waiting to be completed. A non-zero value without any
    filesystem activity indicates a hung or deadlocked filesystem.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • Kobjectify fuse_conn, and make it visible under /sys/fs/fuse/connections.

    Lacking any natural naming, connections are numbered.

    This patch doesn't add any attributes, just the infrastructure.

    Signed-off-by: Miklos Szeredi
    Cc: Greg KH
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • The ->connected flag for a fuse_conn object previously only indicated whether
    the device file for this connection is currently open or not.

    Change it's meaning so that it indicates whether the connection is active or
    not: now either umount or device release will clear the flag.

    The separate ->mounted flag is still needed for handling background requests.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • Create a new list for requests in the process of being transfered to/from
    userspace. This will be needed to be able to abort all requests even those
    currently under I/O

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • The state of request was made up of 2 bitfields (->sent and ->finished) and of
    the fact that the request was on a list or not.

    Unify this into a single state field.

    Signed-off-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi