lkml.org 
[lkml]   [2012]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH v2 2/2] sysfs: provide more diagnostic info for kobject_add_internal() failures
    From
    Date
    1/ convert open-coded KERN_ERR+dump_stack() to WARN(), so that automated
    tools pick up this warning.

    2/ include the 'child' and 'parent' kobject names. This information was
    useful for tracking down the case where scsi invoked device_del() on a
    parent object and subsequently invoked device_add() on a child. Now the
    warning looks like:

    kobject_add_internal failed for target8:0:16 (error: -2 parent: end_device-8:0:24)
    Pid: 2942, comm: scsi_scan_8 Not tainted 3.3.0-rc7-isci+ #2
    Call Trace:
    [<ffffffff8125e551>] kobject_add_internal+0x1c1/0x1f3
    [<ffffffff81075149>] ? trace_hardirqs_on+0xd/0xf
    [<ffffffff8125e659>] kobject_add_varg+0x41/0x50
    [<ffffffff8125e723>] kobject_add+0x64/0x66
    [<ffffffff8131124b>] device_add+0x12d/0x63a
    [<ffffffff8125e0ef>] ? kobject_put+0x4c/0x50
    [<ffffffff8132f370>] scsi_sysfs_add_sdev+0x4e/0x28a
    [<ffffffff8132dce3>] do_scan_async+0x9c/0x145

    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: James Bottomley <JBottomley@parallels.com>
    Signed-off-by: Dan Williams <dan.j.williams@intel.com>
    ---
    lib/kobject.c | 14 +++++++-------
    1 files changed, 7 insertions(+), 7 deletions(-)

    diff --git a/lib/kobject.c b/lib/kobject.c
    index c33d7a1..1bd0893 100644
    --- a/lib/kobject.c
    +++ b/lib/kobject.c
    @@ -192,14 +192,14 @@ static int kobject_add_internal(struct kobject *kobj)

    /* be noisy on error issues */
    if (error == -EEXIST)
    - printk(KERN_ERR "%s failed for %s with "
    - "-EEXIST, don't try to register things with "
    - "the same name in the same directory.\n",
    - __func__, kobject_name(kobj));
    + WARN(1, "%s failed for %s with "
    + "-EEXIST, don't try to register things with "
    + "the same name in the same directory.\n",
    + __func__, kobject_name(kobj));
    else
    - printk(KERN_ERR "%s failed for %s (%d)\n",
    - __func__, kobject_name(kobj), error);
    - dump_stack();
    + WARN(1, "%s failed for %s (error: %d parent: %s)\n",
    + __func__, kobject_name(kobj), error,
    + parent ? kobject_name(parent) : "'none'");
    } else
    kobj->state_in_sysfs = 1;



    \
     
     \ /
      Last update: 2012-04-06 22:29    [W:0.023 / U:29.984 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site