08 Feb, 2008

40 commits

  • Remove the old iget() call and the read_inode() superblock operation it uses
    as these are really obsolete, and the use of read_inode() does not produce
    proper error handling (no distinction between ENOMEM and EIO when marking an
    inode bad).

    Furthermore, this removes the temptation to use iget() to find an inode by
    number in a filesystem from code outside that filesystem.

    iget_locked() should be used instead. A new function is added in an earlier
    patch (iget_failed) that is to be called to mark an inode as bad, unlock it
    and release it should the get routine fail. Mark iget() and read_inode() as
    being obsolete and remove references to them from the documentation.

    Typically a filesystem will be modified such that the read_inode function
    becomes an internal iget function, for example the following:

    void thingyfs_read_inode(struct inode *inode)
    {
    ...
    }

    would be changed into something like:

    struct inode *thingyfs_iget(struct super_block *sp, unsigned long ino)
    {
    struct inode *inode;
    int ret;

    inode = iget_locked(sb, ino);
    if (!inode)
    return ERR_PTR(-ENOMEM);
    if (!(inode->i_state & I_NEW))
    return inode;

    ...
    unlock_new_inode(inode);
    return inode;
    error:
    iget_failed(inode);
    return ERR_PTR(ret);
    }

    and then thingyfs_iget() would be called rather than iget(), for example:

    ret = -EINVAL;
    inode = iget(sb, ino);
    if (!inode || is_bad_inode(inode))
    goto error;

    becomes:

    inode = thingyfs_iget(sb, ino);
    if (IS_ERR(inode)) {
    ret = PTR_ERR(inode);
    goto error;
    }

    Note that is_bad_inode() does not need to be called. The error returned by
    thingyfs_iget() should render it unnecessary.

    Signed-off-by: David Howells
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the HPPFS filesystem from using iget() and read_inode(). Provide an
    hppfs_iget(), and call that instead of iget(). hppfs_iget() then uses
    iget_locked() directly and returns a proper error code instead of an inode in
    the event of an error.

    hppfs_fill_sb_common() returns any error incurred when getting the root inode
    instead of EINVAL.

    Note that the contents of hppfs_kern.c need to be examined:

    (*) The HPPFS inode retains a pointer to the proc dentry it is shadowing, but
    whilst it does appear to retain a reference to it, it doesn't appear to
    destroy the reference if the inode goes away.

    (*) hppfs_iget() should perhaps subsume init_inode() and hppfs_read_inode().

    (*) It would appear that all hppfs inodes are the same inode because iget()
    was being called with inode number 0, which forms the lookup key.

    Signed-off-by: David Howells
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the HOSTFS filesystem from using iget() and read_inode(). Provide
    hostfs_iget(), and call that instead of iget(). hostfs_iget() then uses
    iget_locked() directly and returns a proper error code instead of an inode in
    the event of an error.

    hostfs_fill_sb_common() returns any error incurred when getting the root inode
    instead of EINVAL.

    Note that the contents of hostfs_kern.c need to be examined:

    (*) hostfs_iget() should perhaps subsume init_inode() and hostfs_read_inode().

    (*) It would appear that all hostfs inodes are the same inode because iget()
    was being called with inode number 0 - which forms the lookup key.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: David Howells
    Cc: Jeff Dike
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the OPENPROMFS filesystem from using iget() and read_inode(). Replace
    openpromfs_read_inode() with openpromfs_iget(), and call that instead of
    iget(). openpromfs_iget() then uses iget_locked() directly and returns a
    proper error code instead of an inode in the event of an error.

    openpromfs_fill_super() returns any error incurred when getting the root inode
    instead of ENOMEM (not that it currently incurs any other error).

    Signed-off-by: David Howells
    Cc: "David S. Miller"
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the UFS filesystem from using iget() and read_inode(). Replace
    ufs_read_inode() with ufs_iget(), and call that instead of iget(). ufs_iget()
    then uses iget_locked() directly and returns a proper error code instead of an
    inode in the event of an error.

    ufs_fill_super() returns any error incurred when getting the root inode
    instead of EINVAL.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: David Howells
    Cc: Evgeniy Dushistov
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the SYSV filesystem from using iget() and read_inode(). Replace
    sysv_read_inode() with sysv_iget(), and call that instead of iget().
    sysv_iget() then uses iget_locked() directly and returns a proper error code
    instead of an inode in the event of an error.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: David Howells
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the ROMFS filesystem from using iget() and read_inode(). Replace
    romfs_read_inode() with romfs_iget(), and call that instead of iget().
    romfs_iget() then uses iget_locked() directly and returns a proper error code
    instead of an inode in the event of an error.

    romfs_fill_super() returns any error incurred when getting the root inode
    instead of EINVAL.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: David Howells
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the QNX4 filesystem from using iget() and read_inode(). Replace
    qnx4_read_inode() with qnx4_iget(), and call that instead of iget().
    qnx4_iget() then uses iget_locked() directly and returns a proper error code
    instead of an inode in the event of an error.

    qnx4_fill_super() returns any error incurred when getting the root inode
    instead of EINVAL.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: David Howells
    Cc: Anders Larsen
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the PROCFS filesystem from using iget() and read_inode(). Merge
    procfs_read_inode() into procfs_get_inode(), and have that call iget_locked()
    instead of iget().

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: David Howells
    Cc: "Eric W. Biederman"
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the MINIX filesystem from using iget() and read_inode(). Replace
    minix_read_inode() with minix_iget(), and call that instead of iget().
    minix_iget() then uses iget_locked() directly and returns a proper error code
    instead of an inode in the event of an error.

    minix_fill_super() returns any error incurred when getting the root inode
    instead of EINVAL.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: David Howells
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the JFS filesystem from using iget() and read_inode(). Replace
    jfs_read_inode() with jfs_iget(), and call that instead of iget(). jfs_iget()
    then uses iget_locked() directly and returns a proper error code instead of an
    inode in the event of an error.

    jfs_fill_super() returns any error incurred when getting the root inode
    instead of EINVAL.

    Signed-off-by: David Howells
    Acked-by: Dave Kleikamp
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the JFFS2 filesystem from using iget() and read_inode(). Replace
    jffs2_read_inode() with jffs2_iget(), and call that instead of iget().
    jffs2_iget() then uses iget_locked() directly and returns a proper error code
    instead of an inode in the event of an error.

    jffs2_do_fill_super() returns any error incurred when getting the root inode
    instead of EINVAL.

    Signed-off-by: David Howells
    Cc: David Woodhouse
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the ISOFS filesystem from using read_inode(). Make isofs_read_inode()
    return an error code, and make isofs_iget() pass it on.

    Signed-off-by: David Howells
    Cc: Jan Kara
    Acked-by: Christoph Hellwig
    Cc: "Dave Young"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the HFSPLUS filesystem from using iget() and read_inode(). Replace
    hfsplus_read_inode() with hfsplus_iget(), and call that instead of iget().
    hfsplus_iget() then uses iget_locked() directly and returns a proper error
    code instead of an inode in the event of an error.

    hfsplus_fill_super() returns any error incurred when getting the root inode.

    Signed-off-by: David Howells
    Cc: Roman Zippel
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the FUSE filesystem from using read_inode(), which it doesn't use anyway.

    Signed-off-by: David Howells
    Cc: Miklos Szeredi
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the FreeVXFS filesystem from using iget() and read_inode(). Replace
    vxfs_read_inode() with vxfs_iget(), and call that instead of iget().
    vxfs_iget() then uses iget_locked() directly and returns a proper error code
    instead of an inode in the event of an error.

    vxfs_fill_super() returns any error incurred when getting the root inode
    instead of EINVAL.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: David Howells
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the FAT filesystem from using iget() and read_inode(). Replace the call
    to iget() with a call to ilookup().

    Signed-off-by: David Howells
    Cc: OGAWA Hirofumi
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the EXT4 filesystem from using iget() and read_inode(). Replace
    ext4_read_inode() with ext4_iget(), and call that instead of iget().
    ext4_iget() then uses iget_locked() directly and returns a proper error code
    instead of an inode in the event of an error.

    ext4_fill_super() returns any error incurred when getting the root inode
    instead of EINVAL.

    Signed-off-by: David Howells
    Acked-by: "Theodore Ts'o"
    Acked-by: Jan Kara
    Cc:
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the EXT3 filesystem from using iget() and read_inode(). Replace
    ext3_read_inode() with ext3_iget(), and call that instead of iget().
    ext3_iget() then uses iget_locked() directly and returns a proper error code
    instead of an inode in the event of an error.

    ext3_fill_super() returns any error incurred when getting the root inode
    instead of EINVAL.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: David Howells
    Acked-by: "Theodore Ts'o"
    Acked-by: Jan Kara
    Cc:
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the EXT2 filesystem from using iget() and read_inode(). Replace
    ext2_read_inode() with ext2_iget(), and call that instead of iget().
    ext2_iget() then uses iget_locked() directly and returns a proper error code
    instead of an inode in the event of an error.

    ext2_fill_super() returns any error incurred when getting the root inode
    instead of EINVAL.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: David Howells
    Acked-by: "Theodore Ts'o"
    Cc:
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the EFS filesystem from using iget() and read_inode(). Replace
    efs_read_inode() with efs_iget(), and call that instead of iget(). efs_iget()
    then uses iget_locked() directly and returns a proper error code instead of an
    inode in the event of an error.

    efs_fill_super() returns any error incurred when getting the root inode
    instead of EACCES.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: David Howells
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the CIFS filesystem from using iget() and read_inode(). Replace
    cifs_read_inode() with cifs_iget(), and call that instead of iget().
    cifs_iget() then uses iget_locked() directly and returns a proper error code
    instead of an inode in the event of an error.

    cifs_read_super() now returns any error incurred when getting the root inode
    instead of ENOMEM.

    cifs_iget() needs examining. The comment "can not call macro FreeXid here
    since in a void func" is no longer true.

    Signed-off-by: David Howells
    Cc: Steven French
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the BFS filesystem from using iget() and read_inode(). Replace
    bfs_read_inode() with bfs_iget(), and call that instead of iget(). bfs_iget()
    then uses iget_locked() directly and returns a proper error code instead of an
    inode in the event of an error.

    bfs_fill_super() returns any error incurred when getting the root inode
    instead of EINVAL.

    [kamalesh@linux.vnet.ibm.com: build fix]
    Signed-off-by: David Howells
    Acked-by: Christoph Hellwig
    Signed-off-by: Kamalesh Babulal
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the BEFS filesystem from using iget() and read_inode(). Replace
    befs_read_inode() with befs_iget(), and call that instead of iget().
    befs_iget() then uses iget_locked() directly and returns a proper error code
    instead of an inode in the event of an error.

    befs_fill_super() returns any error incurred when getting the root inode
    instead of EINVAL.

    Signed-off-by: David Howells
    Acked-by: Will Dyson
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the autofs filesystem from using iget() and read_inode(). Replace
    autofs_read_inode() with autofs_iget(), and call that instead of iget().
    autofs_iget() then uses iget_locked() directly and returns a proper error code
    instead of an inode in the event of an error.

    Signed-off-by: David Howells
    Cc: Ian Kent
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Stop the AFFS filesystem from using iget() and read_inode(). Replace
    affs_read_inode() with affs_iget(), and call that instead of iget().
    affs_iget() then uses iget_locked() directly and returns a proper error code
    instead of an inode in the event of an error.

    affs_fill_super() returns any error incurred when getting the root inode
    instead of EINVAL.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: David Howells
    Cc: Roman Zippel
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Use iget_failed() in GFS2 to kill a failed inode.

    Signed-off-by: David Howells
    Cc: Steven Whitehouse
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Use iget_failed() in AFS to kill a failed inode.

    Signed-off-by: David Howells
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Introduce a function to register failure in an inode construction path. This
    includes marking the inode under construction as bad, unlocking it and
    releasing it.

    Signed-off-by: David Howells
    Acked-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Convert instances of ERR_PTR(PTR_ERR(p)) to ERR_CAST(p) using:

    perl -spi -e 's/ERR_PTR[(]PTR_ERR[(](.*)[)][)]/ERR_CAST(\1)/' `grep -rl 'ERR_PTR[(]*PTR_ERR' fs crypto net security`

    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Add an ERR_CAST() function to complement ERR_PTR and co. for the purposes
    of casting an error entyped as one pointer type to an error of another
    pointer type whilst making it explicit as to what is going on.

    This provides a replacement for the ERR_PTR(PTR_ERR(p)) construct.

    Signed-off-by: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    David Howells
     
  • MBCS: Convert the semaphore dmareadlock to the mutex API

    Signed-off-by: Matthias Kaehlcke
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matthias Kaehlcke
     
  • MBCS: Convert the semaphore dmawritelock to the mutex API

    Signed-off-by: Matthias Kaehlcke
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matthias Kaehlcke
     
  • MBCS: Convert the semaphore algolock to the mutex API

    Signed-off-by: Matthias Kaehlcke
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Matthias Kaehlcke
     
  • This patch fixes the configuration dependencies in the vmcoreinfo data.

    i386's "node_data" is defined in arch/x86/mm/discontig_32.c,
    and x86_64's one is defined in arch/x86/mm/numa_64.c.
    They depend on CONFIG_NUMA:
    arch/x86/mm/Makefile_32:7
    obj-$(CONFIG_NUMA) += discontig_32.o
    arch/x86/mm/Makefile_64:7
    obj-$(CONFIG_NUMA) += numa_64.o

    ia64's "pgdat_list" is defined in arch/ia64/mm/discontig.c,
    and it depends on CONFIG_DISCONTIGMEM and CONFIG_SPARSEMEM:
    arch/ia64/mm/Makefile:9-10
    obj-$(CONFIG_DISCONTIGMEM) += discontig.o
    obj-$(CONFIG_SPARSEMEM) += discontig.o

    ia64's "node_memblk" is defined in arch/ia64/mm/numa.c,
    and it depends on CONFIG_NUMA:
    arch/ia64/mm/Makefile:8
    obj-$(CONFIG_NUMA) += numa.o

    Signed-off-by: Ken'ichi Ohmichi
    Acked-by: Simon Horman
    Cc: David Rientjes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ken'ichi Ohmichi
     
  • For readability, all the calls to vmcoreinfo_append_str() are changed to macros
    having a prefix "VMCOREINFO_".

    This discussion is the following:
    http://www.ussg.iu.edu/hypermail/linux/kernel/0709.3/0584.html

    Signed-off-by: Ken'ichi Ohmichi
    Acked-by: Simon Horman
    Cc: David Rientjes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ken'ichi Ohmichi
     
  • It is better that the existing offsetof() is used for VMCOREINFO_OFFSET().

    This discussion is the following:
    http://www.ussg.iu.edu/hypermail/linux/kernel/0709.3/0584.html

    Signed-off-by: Ken'ichi Ohmichi
    Acked-by: Simon Horman
    Cc: David Rientjes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ken'ichi Ohmichi
     
  • This patchset is for the vmcoreinfo data.

    The vmcoreinfo data has the minimum debugging information only for dump
    filtering. makedumpfile (dump filtering command) gets it to distinguish
    unnecessary pages, and makedumpfile creates a small dumpfile.

    This patch:

    VMCOREINFO_SIZE() should be renamed VMCOREINFO_STRUCT_SIZE() since it's always
    returning the size of the struct with a given name. This change would allow
    VMCOREINFO_TYPEDEF_SIZE() to simply become VMCOREINFO_SIZE() since it need not
    be used exclusively for typedefs.

    This discussion is the following:
    http://www.ussg.iu.edu/hypermail/linux/kernel/0709.3/0582.html

    Signed-off-by: Ken'ichi Ohmichi
    Acked-by: David Rientjes
    Acked-by: Simon Horman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ken'ichi Ohmichi
     
  • Use the BOOTMEM_EXCLUSIVE, introduced in the previous patch, to avoid
    conflicts while reserving the memory for the kdump capture kernel
    (crashkernel=).

    Signed-off-by: Bernhard Walle
    Cc:
    Cc: "Eric W. Biederman"
    Cc: Vivek Goyal
    Acked-by: Paul Mundt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Bernhard Walle
     
  • This patchset adds a flags variable to reserve_bootmem() and uses the
    BOOTMEM_EXCLUSIVE flag in crashkernel reservation code to detect collisions
    between crashkernel area and already used memory.

    This patch:

    Change the reserve_bootmem() function to accept a new flag BOOTMEM_EXCLUSIVE.
    If that flag is set, the function returns with -EBUSY if the memory already
    has been reserved in the past. This is to avoid conflicts.

    Because that code runs before SMP initialisation, there's no race condition
    inside reserve_bootmem_core().

    [akpm@linux-foundation.org: coding-style fixes]
    [akpm@linux-foundation.org: fix powerpc build]
    Signed-off-by: Bernhard Walle
    Cc:
    Cc: "Eric W. Biederman"
    Cc: Vivek Goyal
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Bernhard Walle