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
     

10 Jul, 2007

1 commit


17 Jun, 2007

1 commit

  • fs/fuse/inode.c:658:3: error: Initializer entry defined twice
    fs/fuse/inode.c:661:3: also defined here

    Signed-off-by: Alexey Dobriyan
    Acked-by: Miklos Szeredi
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

24 May, 2007

3 commits

  • When inode is dropped (no more references) delete it from cache.

    There's not much point in keeping it cached, when a new lookup will refresh
    the attributes anyway.

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

    Miklos Szeredi
     
  • This fixes O_APPEND in direct IO mode. Also checks writes against file size
    limits, notably rlimits.

    Reported by Greg Bruno.

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

    Miklos Szeredi
     
  • The wrong lookup flag was tested in ->create() causing havoc (error or
    Oops) when a regular file was created with mknod() in a fuse filesystem.

    Thanks to J. Cameijo Cerdeira for the report.

    Kernels 2.6.18 onward are affected. Please apply to -stable as well.

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

    Miklos Szeredi
     

22 May, 2007

1 commit

  • First thing mm.h does is including sched.h solely for can_do_mlock() inline
    function which has "current" dereference inside. By dealing with can_do_mlock()
    mm.h can be detached from sched.h which is good. See below, why.

    This patch
    a) removes unconditional inclusion of sched.h from mm.h
    b) makes can_do_mlock() normal function in mm/mlock.c
    c) exports can_do_mlock() to not break compilation
    d) adds sched.h inclusions back to files that were getting it indirectly.
    e) adds less bloated headers to some files (asm/signal.h, jiffies.h) that were
    getting them indirectly

    Net result is:
    a) mm.h users would get less code to open, read, preprocess, parse, ... if
    they don't need sched.h
    b) sched.h stops being dependency for significant number of files:
    on x86_64 allmodconfig touching sched.h results in recompile of 4083 files,
    after patch it's only 3744 (-8.3%).

    Cross-compile tested on

    all arm defconfigs, all mips defconfigs, all powerpc defconfigs,
    alpha alpha-up
    arm
    i386 i386-up i386-defconfig i386-allnoconfig
    ia64 ia64-up
    m68k
    mips
    parisc parisc-up
    powerpc powerpc-up
    s390 s390-up
    sparc sparc-up
    sparc64 sparc64-up
    um-x86_64
    x86_64 x86_64-up x86_64-defconfig x86_64-allnoconfig

    as well as my two usual configs.

    Signed-off-by: Alexey Dobriyan
    Signed-off-by: Linus Torvalds

    Alexey Dobriyan
     

17 May, 2007

1 commit

  • SLAB_CTOR_CONSTRUCTOR is always specified. No point in checking it.

    Signed-off-by: Christoph Lameter
    Cc: David Howells
    Cc: Jens Axboe
    Cc: Steven French
    Cc: Michael Halcrow
    Cc: OGAWA Hirofumi
    Cc: Miklos Szeredi
    Cc: Steven Whitehouse
    Cc: Roman Zippel
    Cc: David Woodhouse
    Cc: Dave Kleikamp
    Cc: Trond Myklebust
    Cc: "J. Bruce Fields"
    Cc: Anton Altaparmakov
    Cc: Mark Fasheh
    Cc: Paul Mackerras
    Cc: Christoph Hellwig
    Cc: Jan Kara
    Cc: David Chinner
    Cc: "David S. Miller"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     

09 May, 2007

1 commit

  • There's a slight problem with filesystem type representation in fuse
    based filesystems.

    From the kernel's view, there are just two filesystem types: fuse and
    fuseblk. From the user's view there are lots of different filesystem
    types. The user is not even much concerned if the filesystem is fuse based
    or not. So there's a conflict of interest in how this should be
    represented in fstab, mtab and /proc/mounts.

    The current scheme is to encode the real filesystem type in the mount
    source. So an sshfs mount looks like this:

    sshfs#user@server:/ /mnt/server fuse rw,nosuid,nodev,...

    This url-ish syntax works OK for sshfs and similar filesystems. However
    for block device based filesystems (ntfs-3g, zfs) it doesn't work, since
    the kernel expects the mount source to be a real device name.

    A possibly better scheme would be to encode the real type in the type
    field as "type.subtype". So fuse mounts would look like this:

    /dev/hda1 /mnt/windows fuseblk.ntfs-3g rw,...
    user@server:/ /mnt/server fuse.sshfs rw,nosuid,nodev,...

    This patch adds the necessary code to the kernel so that this can be
    correctly displayed in /proc/mounts.

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

    Miklos Szeredi
     

08 May, 2007

2 commits

  • * 'server-cluster-locking-api' of git://linux-nfs.org/~bfields/linux:
    gfs2: nfs lock support for gfs2
    lockd: add code to handle deferred lock requests
    lockd: always preallocate block in nlmsvc_lock()
    lockd: handle test_lock deferrals
    lockd: pass cookie in nlmsvc_testlock
    lockd: handle fl_grant callbacks
    lockd: save lock state on deferral
    locks: add fl_grant callback for asynchronous lock return
    nfsd4: Convert NFSv4 to new lock interface
    locks: add lock cancel command
    locks: allow {vfs,posix}_lock_file to return conflicting lock
    locks: factor out generic/filesystem switch from setlock code
    locks: factor out generic/filesystem switch from test_lock
    locks: give posix_test_lock same interface as ->lock
    locks: make ->lock release private data before returning in GETLK case
    locks: create posix-to-flock helper functions
    locks: trivial removal of unnecessary parentheses

    Linus Torvalds
     
  • I have never seen a use of SLAB_DEBUG_INITIAL. It is only supported by
    SLAB.

    I think its purpose was to have a callback after an object has been freed
    to verify that the state is the constructor state again? The callback is
    performed before each freeing of an object.

    I would think that it is much easier to check the object state manually
    before the free. That also places the check near the code object
    manipulation of the object.

    Also the SLAB_DEBUG_INITIAL callback is only performed if the kernel was
    compiled with SLAB debugging on. If there would be code in a constructor
    handling SLAB_DEBUG_INITIAL then it would have to be conditional on
    SLAB_DEBUG otherwise it would just be dead code. But there is no such code
    in the kernel. I think SLUB_DEBUG_INITIAL is too problematic to make real
    use of, difficult to understand and there are easier ways to accomplish the
    same effect (i.e. add debug code before kfree).

    There is a related flag SLAB_CTOR_VERIFY that is frequently checked to be
    clear in fs inode caches. Remove the pointless checks (they would even be
    pointless without removeal of SLAB_DEBUG_INITIAL) from the fs constructors.

    This is the last slab flag that SLUB did not support. Remove the check for
    unimplemented flags from SLUB.

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

    Christoph Lameter
     

07 May, 2007

1 commit


03 May, 2007

1 commit


09 Apr, 2007

1 commit


13 Feb, 2007

2 commits

  • This patch is inspired by Arjan's "Patch series to mark struct
    file_operations and struct inode_operations const".

    Compile tested with gcc & sparse.

    Signed-off-by: Josef 'Jeff' Sipek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Josef 'Jeff' Sipek
     
  • Many struct inode_operations in the kernel can be "const". Marking them const
    moves these to the .rodata section, which avoids false sharing with potential
    dirty data. In addition it'll catch accidental writes at compile time to
    these shared resources.

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

    Arjan van de Ven
     

12 Feb, 2007

1 commit


31 Jan, 2007

1 commit

  • The BUG in fuse_ctl_add_dentry() could be triggered if the control
    filesystem was unmounted and mounted again while one or more fuse
    filesystems were present.

    The fix is to reset the dentry counter in fuse_ctl_kill_sb().

    Bug reported by Florent Mertens.

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

    Miklos Szeredi
     

22 Dec, 2006

1 commit

  • The use by FUSE was just a remnant of an optimization from the time
    when writable mappings were supported.

    Now FUSE never actually allows the creation of dirty pages, so this
    invocation of clear_page_dirty() is effectively a no-op.

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

    Miklos Szeredi
     

09 Dec, 2006

1 commit


08 Dec, 2006

8 commits

  • Randy Dunlap wote:
    > Should FUSE depend on BLOCK? Without that and with BLOCK=n, I get:
    >
    > inode.c:(.text+0x3acc5): undefined reference to `sb_set_blocksize'
    > inode.c:(.text+0x3a393): undefined reference to `get_sb_bdev'
    > fs/built-in.o:(.data+0xd718): undefined reference to `kill_block_super

    Most fuse filesystems work fine without block device support, so I
    think a better solution is to disable the 'fuseblk' filesystem type if
    BLOCK=n.

    Signed-off-by: Miklos Szeredi
    Acked-by: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi
     
  • Add a DESTROY operation for block device based filesystems. With the help of
    this operation, such a filesystem can flush dirty data to the device
    synchronously before the umount returns.

    This is needed in situations where the filesystem is assumed to be clean
    immediately after unmount (e.g. ejecting removable media).

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

    Miklos Szeredi
     
  • Add support for the BMAP operation for block device based filesystems. This
    is needed to support swap-files and lilo.

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

    Miklos Szeredi
     
  • Add 'blksize' option for block device based filesystems. During
    initialization this is used to set the block size on the device and the super
    block. The default block size is 512bytes.

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

    Miklos Szeredi
     
  • I never intended this, but people started using fuse to implement block device
    based "real" filesystems (ntfs-3g, zfs).

    The following four patches add better support for these kinds of filesystems.
    Unlike "normal" fuse filesystems, using this feature should require superuser
    privileges (enforced by the fusermount utility).

    Thanks to Szabolcs Szakacsits for the input and testing.

    This patch adds a 'fuseblk' filesystem type, which is only different from the
    'fuse' filesystem type in how the 'dev_name' mount argument is interpreted.

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

    Miklos Szeredi
     
  • Remove unneeded code from fuse_dentry_revalidate(). This made some sense
    while the validity time could wrap around, but now it's a very obvious no-op.

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

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

26 Nov, 2006

1 commit

  • Fix bug in certain error paths of lookup routines. The request object was
    reused for sending FORGET, which is illegal. This bug could cause an Oops
    in 2.6.18. In earlier versions it might silently corrupt memory, but this
    is very unlikely.

    These error paths are never triggered by libfuse, so this wasn't noticed
    even with the 2.6.18 kernel, only with a filesystem using the raw kernel
    interface.

    Thanks to Russ Cox for the bug report and test filesystem.

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

    Miklos Szeredi
     

04 Nov, 2006

1 commit


17 Oct, 2006

5 commits

  • There's no locking for ->d_revalidate, so fuse_dentry_revalidate() should use
    dget_parent() instead of simply dereferencing ->d_parent.

    Due to topology changes in the directory tree the parent could become negative
    or be destroyed while being used. There hasn't been any reports about this
    yet.

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

    Miklos Szeredi
     
  • Fuse considered it an error (EIO) if lookup returned a directory inode, to
    which a dentry already refered. This is because directory aliases are not
    allowed.

    But in a network filesystem this could happen legitimately, if a directory is
    moved on a remote client. This patch attempts to relax the restriction by
    trying to first evict the offending alias from the cache. If this fails, it
    still returns an error (EBUSY).

    A rarer situation is if an mkdir races with an indenpendent lookup, which
    finds the newly created directory already moved. In this situation the mkdir
    should return success, but that would be incorrect, since the dentry cannot be
    instantiated, so return EBUSY.

    Previously checking for a directory alias and instantiation of the dentry
    weren't done atomically in lookup/mkdir, hence two such calls racing with each
    other could create aliased directories. To prevent this introduce a new
    per-connection mutex: fuse_conn->inst_mutex, which is taken for instantiations
    with a directory inode.

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

    Miklos Szeredi
     
  • Fix a spurious BUG in an unlikely race, where at least three parallel lookups
    return the same inode, but with different file type. This has not yet been
    observed in real life.

    Allowing unlimited retries could delay fuse_iget() indefinitely, but this is
    really for the broken userspace filesystem to worry about.

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

    Miklos Szeredi
     
  • An inode could be returned by independent parallel lookups, in this case an
    update of the lookup counter could be lost resulting in a memory leak in
    userspace.

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

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

    Miklos Szeredi
     

01 Oct, 2006

4 commits

  • Some filesystems, instead of simply decrementing i_nlink, simply zero it
    during an unlink operation. We need to catch these in addition to the
    decrement operations.

    Signed-off-by: Dave Hansen
    Acked-by: Christoph Hellwig
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Hansen
     
  • This is mostly included for parity with dec_nlink(), where we will have some
    more hooks. This one should stay pretty darn straightforward for now.

    Signed-off-by: Dave Hansen
    Acked-by: Christoph Hellwig
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Hansen
     
  • This patch cleans up generic_file_*_read/write() interfaces. Christoph
    Hellwig gave me the idea for this clean ups.

    In a nutshell, all filesystems should set .aio_read/.aio_write methods and use
    do_sync_read/ do_sync_write() as their .read/.write methods. This allows us
    to cleanup all variants of generic_file_* routines.

    Final available interfaces:

    generic_file_aio_read() - read handler
    generic_file_aio_write() - write handler
    generic_file_aio_write_nolock() - no lock write handler

    __generic_file_aio_write_nolock() - internal worker routine

    Signed-off-by: Badari Pulavarty
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Badari Pulavarty
     
  • This patch removes readv() and writev() methods and replaces them with
    aio_read()/aio_write() methods.

    Signed-off-by: Badari Pulavarty
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Badari Pulavarty
     

30 Sep, 2006

1 commit

  • In the "operation does permission checking" model used by fuse, chdir
    permission is not checked, since there's no chdir method.

    For this case set a lookup flag, which will be passed to ->permission(), so
    fuse can distinguish it from permission checks for other operations.

    Signed-off-by: Miklos Szeredi
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miklos Szeredi