diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-24 12:04:12 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-24 12:04:12 -0800 |
commit | 5c6cad6dac229ea0c07f924c7d5826ec10a3b303 (patch) | |
tree | fa2a41730c73ef477b64ef25ffe176c938a72c41 /driver | |
parent | c2f216c93df8417edecef001bfb3bfb2ef1709a3 (diff) | |
download | patches-5c6cad6dac229ea0c07f924c7d5826ec10a3b303.tar.gz |
new patch
Diffstat (limited to 'driver')
-rw-r--r-- | driver/sysfs-crash-debugging.patch | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/driver/sysfs-crash-debugging.patch b/driver/sysfs-crash-debugging.patch new file mode 100644 index 0000000000000..23e978571e172 --- /dev/null +++ b/driver/sysfs-crash-debugging.patch @@ -0,0 +1,110 @@ + +From: Andrew Morton <akpm@osdl.org> + +Display the most-recently-opened sysfs file's name when oopsing. + +From: Adrian Bunk <bunk@stusta.de> + + Build fix + +From: Greg Kroah-Hartman <gregkh@suse.de> + + Modified to make the api call cleaner, and available to all arches if + need be. Also added it to x86-64's crash dump message. + + +Signed-off-by: Adrian Bunk <bunk@stusta.de> +Signed-off-by: Andrew Morton <akpm@osdl.org> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + arch/i386/kernel/traps.c | 3 ++- + arch/x86_64/kernel/traps.c | 1 + + fs/sysfs/file.c | 14 ++++++++++++++ + include/linux/sysfs.h | 7 +++++++ + 4 files changed, 24 insertions(+), 1 deletion(-) + +--- gregkh-2.6.orig/fs/sysfs/file.c ++++ gregkh-2.6/fs/sysfs/file.c +@@ -7,6 +7,8 @@ + #include <linux/kobject.h> + #include <linux/namei.h> + #include <linux/poll.h> ++#include <linux/limits.h> ++ + #include <asm/uaccess.h> + #include <asm/semaphore.h> + +@@ -15,6 +17,9 @@ + #define to_subsys(k) container_of(k,struct subsystem,kset.kobj) + #define to_sattr(a) container_of(a,struct subsys_attribute,attr) + ++/* used in crash dumps to help with debugging */ ++static char last_sysfs_file[PATH_MAX]; ++ + /* + * Subsystem file operations. + * These operations allow subsystems to have files that can be +@@ -330,9 +335,18 @@ static int check_perm(struct inode * ino + + static int sysfs_open_file(struct inode * inode, struct file * filp) + { ++ char *p = d_path(filp->f_dentry, sysfs_mount, last_sysfs_file, ++ sizeof(last_sysfs_file)); ++ if (p) ++ memmove(last_sysfs_file, p, strlen(p) + 1); + return check_perm(inode,filp); + } + ++void sysfs_printk_last_file(void) ++{ ++ printk(KERN_EMERG "last sysfs file: %s\n", last_sysfs_file); ++} ++ + static int sysfs_release(struct inode * inode, struct file * filp) + { + struct kobject * kobj = to_kobj(filp->f_dentry->d_parent); +--- gregkh-2.6.orig/arch/i386/kernel/traps.c ++++ gregkh-2.6/arch/i386/kernel/traps.c +@@ -362,7 +362,8 @@ void die(const char * str, struct pt_reg + #endif + if (nl) + printk("\n"); +- notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); ++ sysfs_printk_last_file(); ++ notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); + show_registers(regs); + } else + printk(KERN_EMERG "Recursive die() failure, output suppressed\n"); +--- gregkh-2.6.orig/include/linux/sysfs.h ++++ gregkh-2.6/include/linux/sysfs.h +@@ -120,6 +120,8 @@ int sysfs_create_group(struct kobject *, + void sysfs_remove_group(struct kobject *, const struct attribute_group *); + + void sysfs_notify(struct kobject * k, char *dir, char *attr); ++void sysfs_printk_last_file(void); ++ + #else /* CONFIG_SYSFS */ + + static inline int sysfs_create_dir(struct kobject * k) +@@ -192,6 +194,11 @@ static inline void sysfs_notify(struct k + ; + } + ++static inline void sysfs_printk_last_file(void) ++{ ++ ; ++} ++ + #endif /* CONFIG_SYSFS */ + + #endif /* _SYSFS_H_ */ +--- gregkh-2.6.orig/arch/x86_64/kernel/traps.c ++++ gregkh-2.6/arch/x86_64/kernel/traps.c +@@ -414,6 +414,7 @@ void __die(const char * str, struct pt_r + printk("DEBUG_PAGEALLOC"); + #endif + printk("\n"); ++ sysfs_printk_last_file(); + notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV); + show_registers(regs); + /* Executive summary in case the oops scrolled away */ |