sysfs: crash debugging

Print the name of the last-accessed sysfs file when we oops, to help track
down oopses which occur in sysfs store/read handlers.  Because these oopses
tend to not leave any trace of the offending code in the stack traces.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Andrew Morton
2007-08-24 16:11:54 -07:00
committed by Greg Kroah-Hartman
parent e94320939f
commit ae87221d3c
4 changed files with 23 additions and 0 deletions

View File

@ -119,6 +119,8 @@ void sysfs_remove_file_from_group(struct kobject *kobj,
void sysfs_notify(struct kobject *kobj, char *dir, char *attr);
void sysfs_printk_last_file(void);
extern int __must_check sysfs_init(void);
#else /* CONFIG_SYSFS */
@ -231,6 +233,10 @@ static inline int __must_check sysfs_init(void)
return 0;
}
static inline void sysfs_printk_last_file(void)
{
}
#endif /* CONFIG_SYSFS */
#endif /* _SYSFS_H_ */