26 Jan, 2008

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (200 commits)
    [SCSI] usbstorage: use last_sector_bug flag universally
    [SCSI] libsas: abstract STP task status into a function
    [SCSI] ultrastor: clean up inline asm warnings
    [SCSI] aic7xxx: fix firmware build
    [SCSI] aacraid: fib context lock for management ioctls
    [SCSI] ch: remove forward declarations
    [SCSI] ch: fix device minor number management bug
    [SCSI] ch: handle class_device_create failure properly
    [SCSI] NCR5380: fix section mismatch
    [SCSI] sg: fix /proc/scsi/sg/devices when no SCSI devices
    [SCSI] IB/iSER: add logical unit reset support
    [SCSI] don't use __GFP_DMA for sense buffers if not required
    [SCSI] use dynamically allocated sense buffer
    [SCSI] scsi.h: add macro for enclosure bit of inquiry data
    [SCSI] sd: add fix for devices with last sector access problems
    [SCSI] fix pcmcia compile problem
    [SCSI] aacraid: add Voodoo Lite class of cards.
    [SCSI] aacraid: add new driver features flags
    [SCSI] qla2xxx: Update version number to 8.02.00-k7.
    [SCSI] qla2xxx: Issue correct MBC_INITIALIZE_FIRMWARE command.
    ...

    Linus Torvalds
     

25 Jan, 2008

5 commits

  • Remove the no longer needed subsys_attributes, they are all converted to
    the more sensical kobj_attributes.

    There is no longer a magic fallback in sysfs attribute operations, all
    kobjects which create simple attributes need explicitely a ktype
    assigned, which tells the core what was intended here.

    Signed-off-by: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     
  • We don't need a "default" ktype for a kset. We should set this
    explicitly every time for each kset. This change is needed so that we
    can make ksets dynamic, and cleans up one of the odd, undocumented
    assumption that the kset/kobject/ktype model has.

    This patch is based on a lot of help from Kay Sievers.

    Nasty bug in the block code was found by Dave Young

    Cc: Kay Sievers
    Cc: Dave Young
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • SPIN_LOCK_UNLOCKED is deprecated, use DEFINE_SPINLOCK instead

    Signed-off-by: Jiri Slaby
    Signed-off-by: Andrew Morton
    Cc: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    Jiri Slaby
     
  • Instead of walking from the source down to the root of sysfs, and back
    to the target, we stop at the first directory the source and the target
    share.

    This link:
    /devices/pci0000:00/0000:00:1d.7/usb1/1-0:1.0/ep_81

    pointed to:
    ../../../../../devices/pci0000:00/0000:00:1d.0/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81

    now it just points to:
    usb_endpoint/usbdev1.1_ep81

    Thanks to Denis Cheng for bringing this up, and sending the initial patch.

    CC: Denis Cheng
    Signed-off-by: Kay Sievers
    Signed-off-by: Greg Kroah-Hartman

    Kay Sievers
     
  • Signed-off-by: Jean Delvare
    Signed-off-by: Greg Kroah-Hartman

    Jean Delvare
     

24 Jan, 2008

2 commits

  • This patch allows the various users of attribute_groups to selectively
    allow the appearance of group attributes. The primary consumer of
    this will be the transport classes in which we currently have
    elaborate attribute selection algorithms to do this same thing.

    Acked-by: Greg KH
    Signed-off-by: James Bottomley

    James Bottomley
     
  • I can't see a reason why these shouldn't work on every group. However,
    they only seem to work on named groups. This patch allows the group
    functions to work on anonymous groups (those with NULL names).

    Acked-by: Tejun Heo
    Acked-by: Kay Sievers
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: James Bottomley

    James Bottomley
     

17 Jan, 2008

2 commits

  • sysfs_rename/move_dir() have the following bugs.

    - On dentry lookup failure, kfree() is called on ERR_PTR() value.
    - sysfs_move_dir() has an extra dput() on success path.

    Fix them.

    Signed-off-by: Tejun Heo
    Signed-off-by: Linus Torvalds

    Tejun Heo
     
  • sysfs tries to keep dcache a strict subset of sysfs_dirent tree by
    shooting down dentries when a node is removed, that is, no negative
    dentry for sysfs. However, the lookup function returned NULL and thus
    created negative dentries when the target node didn't exist.

    Make sysfs_lookup() return ERR_PTR(-ENOENT) on lookup failure. This
    fixes the NULL dereference bug in sysfs_get_dentry() discovered by
    bluetooth rfcomm device moving around.

    Signed-off-by: Tejun Heo
    Signed-off-by: Linus Torvalds

    Tejun Heo
     

29 Nov, 2007

1 commit

  • I found that there is a off-by-one problem in the following code.

    Version: 2.6.24-rc2
    File: fs/sysfs/file.c:118-122
    Function: fill_read_buffer
    --------------------------------------------------------------------
    count = ops->show(kobj, attr_sd->s_attr.attr, buffer->page);

    sysfs_put_active_two(attr_sd);

    BUG_ON(count > (ssize_t)PAGE_SIZE);
    --------------------------------------------------------------------

    Because according to the specification of the sysfs and the implement of
    the show methods, the show methods return the number of bytes which would
    be generated for the given input, excluding the trailing null.So if the
    return value of the show methods equals PAGE_SIZE - 1, the buffer is full
    in fact. And if the return value equals PAGE_SIZE, the resulting string
    was already truncated,or buffer overflow occurred.

    This patch fixes an off-by-one error in fill_read_buffer.

    Signed-off-by: Miao Xie
    Signed-off-by: Andrew Morton
    Acked-by: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    Miao Xie
     

31 Oct, 2007

1 commit


20 Oct, 2007

1 commit


17 Oct, 2007

4 commits

  • Replace some SPIN_LOCK_UNLOCKED with DEFINE_SPINLOCK

    Signed-off-by: Roel Kluin
    Acked-by: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Roel Kluin
     
  • provide BDI constructor/destructor hooks

    [akpm@linux-foundation.org: compile fix]
    Signed-off-by: Peter Zijlstra
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     
  • Try to fix the mess created by sysfs braindamage.

    - refactor code internal to fs/namei.c a little to avoid too much
    duplication:
    o __lookup_hash_kern is renamed back to __lookup_hash
    o the old __lookup_hash goes away, permission checks moves to
    the two callers
    o useless inline qualifiers on above functions go away
    - lookup_one_len_kern loses it's last argument and is renamed to
    lookup_one_noperm to make it's useage a little more clear
    - added kerneldoc comments to describe lookup_one_len aswell as
    lookup_one_noperm and make it very clear that no one should use
    the latter ever.

    Signed-off-by: Christoph Hellwig
    Cc: Josef 'Jeff' Sipek
    Cc: Miklos Szeredi
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     
  • Implement new aops for some of the simpler filesystems.

    Signed-off-by: Nick Piggin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nick Piggin
     

13 Oct, 2007

23 commits

  • Sysfs has gone through considerable amount of reimplementation. Add
    copyrights. Any objections? :-)

    Signed-off-by: Tejun Heo
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • Sysfs file poll implementation is scattered over sysfs and kobject.
    Event numbering is done in sysfs_dirent but wait itself is done on
    kobject. This not only unecessarily bloats both kobject and
    sysfs_dirent but is also buggy - if a sysfs_dirent is removed while
    there still are pollers, the associaton betwen the kobject and
    sysfs_dirent breaks and kobject may be freed with the pollers still
    sleeping on it.

    This patch moves whole poll implementation into sysfs_open_dirent.
    Each time a sysfs_open_dirent is created, event number restarts from 1
    and pollers sleep on sysfs_open_dirent. As event sequence number is
    meaningless without any open file and pollers should have open file
    and thus sysfs_open_dirent, this ephemeral event counting works and is
    a saner implementation.

    This patch fixes the dnagling sleepers bug and reduces the sizes of
    kobject and sysfs_dirent by one pointer.

    Signed-off-by: Tejun Heo
    Acked-by: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • Implement sysfs_open_dirent which represents an open file (attribute)
    sysfs_dirent. A file sysfs_dirent with one or more open files have
    one sysfs_dirent and all sysfs_buffers (one for each open instance)
    are linked to it.

    sysfs_open_dirent doesn't actually do anything yet but will be used to
    off-load things which are specific for open file sysfs_dirent from it.

    Signed-off-by: Tejun Heo
    Acked-by: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • Children list head is only meaninful for directory nodes. Move it
    into s_dir. This doesn't save any space currently but it will with
    further changes.

    Signed-off-by: Tejun Heo
    Acked-by: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • sysfs_root is different from a regular directory dirent in that it's
    of type SYSFS_ROOT and doesn't have a name. These differences aren't
    used by anybody and only adds to complexity. Make sysfs_root a
    regular directory dirent.

    Signed-off-by: Tejun Heo
    Acked-by: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • sysfs_attach_dentry() now has only one caller and isn't doing much
    other than obfuscating the code. Open code and kill it.

    Signed-off-by: Tejun Heo
    Acked-by: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • Make s_elem an anonymous union. Prefixing with s_elem makes things
    needlessly longer without any advantage.

    Signed-off-by: Tejun Heo
    Acked-by: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • All bin attr operations require active references of itself and its
    parent. There's no reason to allow open when its parent has been
    deactivated and allowing it is inconsistent with regular sysfs file.
    Use sysfs_get_active_two() in bin attribute open function.

    Signed-off-by: Tejun Heo
    Acked-by: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • In sysfs_release(), sysfs_buffer pointed to by filp->private_data is
    guaranteed to exist. Kill the unnecessary NULL check. This also
    makes the code more consistent with the counterpart in fs/sysfs/bin.c.

    Signed-off-by: Tejun Heo
    Acked-by: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • There's no reason to get an extra reference to sysfs_dirent for an
    open file. Open file has a reference to the dentry which in turn has
    a reference to sysfs_dirent. This is fairly obvious as otherwise open
    itself won't be able to access the sysfs_dirent. Kill the extra
    sysfs_get() and matching sysfs_put().

    Signed-off-by: Tejun Heo
    Acked-by: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • Move s_mode downward such that it's side-by-side with s_iattr which is
    used for the same thing.

    Signed-off-by: Tejun Heo
    Acked-by: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • sysfs_update_file() depends on inode->i_mtime but sysfs iondes are now
    reclaimable making the reported modification time unreliable. There's
    only one user (pci hotplug) of this notification mechanism and it
    reportedly isn't utilized from userland.

    Kill sysfs_update_file().

    Signed-off-by: Tejun Heo
    Acked-by: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • sysfs is about to go through major overhaul making this a pretty good
    opportunity to clean up (out-of-tree changes and pending patches will
    need regeneration anyway). Clean up headers.

    * Kill space between * and symbolname.

    * Move SYSFS_* type constants and flags into fs/sysfs/sysfs.h.
    They're internal to sysfs.

    * Reformat function prototypes and add argument symbol names.

    * Make dummy function definition order match that of function
    prototypes.

    * Add some comments.

    * Reorganize fs/sysfs/sysfs.h according to which file the declared
    variable or feature lives in.

    This patch does not introduce any behavior change.

    Signed-off-by: Tejun Heo
    Acked-by: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • sysfs_chmod_file() looked and updated only inode of the target file.
    Dentry and inode are reclaimable and the update mode data will go away
    when the inode is reclaimed. This patch makes sysfs_chmod_file()
    update sd->s_mode too such that the change is permanent.

    Signed-off-by: Tejun Heo
    Acked-by: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • sysfs_add/remove_one() now link and unlink the target dirent into and
    from the children list. Update comments accordingly.

    Signed-off-by: Tejun Heo
    Acked-by: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • We want to let people know when we create a duplicate sysfs file, as
    they need to fix up their code.

    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • This patch rewrites sysfs_move_dir to perform it's checks
    as much as possible on the underlying sysfs_dirents instead
    of the contents of the dcache, making sysfs_move_dir
    more like the rest of the sysfs directory modification
    code.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Tejun Heo
    Cc: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     
  • This patch rewrites sysfs_rename_dir to perform it's checks
    as much as possible on the underlying sysfs_dirents instead
    of the contents of the dcache. It turns out that this version
    is a little simpler, and a little more like the rest of
    the sysfs directory modification code.

    tj: fixed double locking of sysfs_mutex

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Tejun Heo
    Cc: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     
  • The only uses of s_dentry left are the code that maintains
    s_dentry and trivial users that don't actually need it.
    So this patch removes the s_dentry maintenance code and
    restructures the trivial uses to use something else.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Tejun Heo
    Cc: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     
  • Now that we know the sysfs tree structure cannot change under us and
    sysfs shadow support is dropped, sysfs_get_dentry() can be simplified
    greatly. It can just look up from the root and there's no need to
    retry on failure.

    Signed-off-by: Tejun Heo
    Cc: Eric W. Biederman
    Cc: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Tejun Heo
     
  • Looking carefully at the rename code we have a subtle dependency
    that the structure of sysfs not change while we are performing
    a rename. If the parent directory of the object we are renaming
    changes while the rename is being performed nasty things could
    happen when we go to release our locks.

    So introduce a sysfs_rename_mutex to prevent this highly
    unlikely theoretical issue.

    In addition hold sysfs_rename_mutex over all calls to
    sysfs_get_dentry. Allowing sysfs_get_dentry to be simplified
    in the future.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Tejun Heo
    Cc: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     
  • Currently we find the dentry to drop by looking at sd->s_dentry.
    We can just as easily accomplish the same task by looking up the
    sysfs inode and finding all of the dentries from there, with the
    added bonus that we don't need to play with the sysfs_assoc_lock.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Tejun Heo
    Cc: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman
     
  • At some point someone wrote sysfs_readdir to insert a cursor
    into the list of sysfs_dirents to ensure that sysfs_readdir would
    restart properly. That works but it is complex code and tends
    to be expensive.

    The same effect can be achieved by keeping the sysfs_dirents in
    inode order and using the inode number as the f_pos. Then
    when we restart we just have to find the first dirent whose inode
    number is equal or greater then the last sysfs_dirent we attempted
    to return.

    Removing the sysfs directory cursor also allows the remove of
    all of the mysterious checks for sysfs_type(sd) != 0. Which
    were nonbovious checks to see if a cursor was in a directory list.

    tj: offset marker for EOF is changed from UINT_MAX to INT_MAX to avoid
    overflow in case offset is 32bit.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Tejun Heo
    Cc: Cornelia Huck
    Signed-off-by: Greg Kroah-Hartman

    Eric W. Biederman