diff options
author | Dan Williams <dan.j.williams@intel.com> | 2012-04-06 16:41:15 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-10 17:48:51 -0400 |
commit | 282029c005e65ffdce3aa9f8220f88a8bbbc4dae (patch) | |
tree | 48d488d453def3bd1c408aed1bd4bb4e18115b4c /lib | |
parent | 3a198886ab5f228fcbebb9ace803d8b99721d49a (diff) |
kobject: provide more diagnostic info for kobject_add_internal() failures
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kobject.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/kobject.c b/lib/kobject.c index 21dee7c19afd..aeefa8bc8b1c 100644 --- a/lib/kobject.c +++ b/lib/kobject.c | |||
@@ -192,14 +192,14 @@ static int kobject_add_internal(struct kobject *kobj) | |||
192 | 192 | ||
193 | /* be noisy on error issues */ | 193 | /* be noisy on error issues */ |
194 | if (error == -EEXIST) | 194 | if (error == -EEXIST) |
195 | printk(KERN_ERR "%s failed for %s with " | 195 | WARN(1, "%s failed for %s with " |
196 | "-EEXIST, don't try to register things with " | 196 | "-EEXIST, don't try to register things with " |
197 | "the same name in the same directory.\n", | 197 | "the same name in the same directory.\n", |
198 | __func__, kobject_name(kobj)); | 198 | __func__, kobject_name(kobj)); |
199 | else | 199 | else |
200 | printk(KERN_ERR "%s failed for %s (%d)\n", | 200 | WARN(1, "%s failed for %s (error: %d parent: %s)\n", |
201 | __func__, kobject_name(kobj), error); | 201 | __func__, kobject_name(kobj), error, |
202 | dump_stack(); | 202 | parent ? kobject_name(parent) : "'none'"); |
203 | } else | 203 | } else |
204 | kobj->state_in_sysfs = 1; | 204 | kobj->state_in_sysfs = 1; |
205 | 205 | ||