public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: vincent.fortier1@ec.gc.ca, linux-kernel@vger.kernel.org
Subject: Re: 2.6.22.14 oops msg with commvault galaxy ?
Date: Fri, 7 Dec 2007 17:14:55 -0800	[thread overview]
Message-ID: <20071207171455.b2eecb60.randy.dunlap@oracle.com> (raw)
In-Reply-To: <20071207151113.e9841341.akpm@linux-foundation.org>

On Fri, 7 Dec 2007 15:11:13 -0800 Andrew Morton wrote:

> On Fri, 7 Dec 2007 14:15:36 -0800
> Randy Dunlap <randy.dunlap@oracle.com> wrote:
> 
> > > Help would really be appreciated.
> > 
> > Let's try the last_sysfs_file (name) patch.
> > I've attempted to update it for 2.6.22.14.
> > Andrew, does this change in fs/sysfs/file.c look OK?
> 
> umm, yup.
> 
> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.21-rc6/2.6.21-rc6-mm1/broken-out/gregkh-driver-sysfs-crash-debugging.patch
> 
> should work.

Thanks.  
I produced a cleanly applying version of it for 2.6.22.14.

Vincent, please apply this patch so we can know which file in sysfs
these oopses are happening with.

---


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   |    1 +
 arch/x86_64/kernel/traps.c |    1 +
 fs/sysfs/file.c            |   14 ++++++++++++++
 include/linux/sysfs.h      |    6 ++++++
 4 files changed, 22 insertions(+)

--- linux-2.6.22.14.orig/arch/i386/kernel/traps.c
+++ linux-2.6.22.14/arch/i386/kernel/traps.c
@@ -411,6 +411,7 @@ void die(const char * str, struct pt_reg
 #endif
 		if (nl)
 			printk("\n");
+		sysfs_printk_last_file();
 		if (notify_die(DIE_OOPS, str, regs, err,
 					current->thread.trap_no, SIGSEGV) !=
 				NOTIFY_STOP) {
--- linux-2.6.22.14.orig/arch/x86_64/kernel/traps.c
+++ linux-2.6.22.14/arch/x86_64/kernel/traps.c
@@ -516,6 +516,7 @@ void __kprobes __die(const char * str, s
 	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 */
--- linux-2.6.22.14.orig/fs/sysfs/file.c
+++ linux-2.6.22.14/fs/sysfs/file.c
@@ -8,6 +8,7 @@
 #include <linux/namei.h>
 #include <linux/poll.h>
 #include <linux/list.h>
+#include <linux/limits.h>
 #include <asm/uaccess.h>
 #include <asm/semaphore.h>
 
@@ -15,6 +16,13 @@
 
 #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];
+void sysfs_printk_last_file(void)
+{
+	printk(KERN_EMERG "last sysfs file: %s\n", last_sysfs_file);
+}
+
 /*
  * Subsystem file operations.
  * These operations allow subsystems to have files that can be 
@@ -253,6 +261,12 @@ static int sysfs_open_file(struct inode 
 	struct sysfs_buffer * buffer;
 	struct sysfs_ops * ops = NULL;
 	int error = 0;
+	char *p;
+
+	p = d_path(file->f_dentry, sysfs_mount, last_sysfs_file,
+		   sizeof(last_sysfs_file));
+	if (p)
+		memmove(last_sysfs_file, p, strlen(p) + 1);
 
 	if (!kobj || !attr)
 		goto Einval;
--- linux-2.6.22.14.orig/include/linux/sysfs.h
+++ linux-2.6.22.14/include/linux/sysfs.h
@@ -125,6 +125,7 @@ void sysfs_remove_file_from_group(struct
 		const struct attribute *attr, const char *group);
 
 void sysfs_notify(struct kobject * k, char *dir, char *attr);
+void sysfs_printk_last_file(void);
 
 
 extern int sysfs_make_shadowed_dir(struct kobject *kobj,
@@ -240,6 +241,11 @@ static inline int __must_check sysfs_ini
 	return 0;
 }
 
+static inline void sysfs_printk_last_file(void)
+{
+	;
+}
+
 #endif /* CONFIG_SYSFS */
 
 #endif /* _SYSFS_H_ */

  reply	other threads:[~2007-12-08  1:16 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-30 13:02 2.6.22.14 oops msg with commvault galaxy ? Vincent Fortier
2007-11-30 17:12 ` Randy Dunlap
2007-11-30 17:35   ` Fortier,Vincent [Montreal]
2007-12-04 13:47     ` Vincent Fortier
2007-12-07 22:15       ` Randy Dunlap
2007-12-07 23:11         ` Andrew Morton
2007-12-08  1:14           ` Randy Dunlap [this message]
2007-12-10 13:20             ` Fortier,Vincent [Montreal]
2007-12-10 14:03               ` Fortier,Vincent [Montreal]
2007-12-10 17:15                 ` Randy Dunlap
2007-12-10 17:55                   ` Fortier,Vincent [Montreal]
2007-12-11 14:54                   ` Dhaval Giani
2007-12-11 16:43                     ` Dhaval Giani
2007-12-11 17:04                       ` Greg KH
2007-12-11 17:23                         ` Dhaval Giani
2007-12-11 17:47                           ` Fortier,Vincent [Montreal]
2007-12-11 18:20                             ` Dhaval Giani
2007-12-11 18:25                               ` Dhaval Giani
2007-12-11 19:08                                 ` Fortier,Vincent [Montreal]
2007-12-11 19:12                                   ` Randy Dunlap
2007-12-11 21:06                                   ` Ingo Molnar
2007-12-12  7:08                                     ` Dhaval Giani
2007-12-12 12:57                                       ` Fortier,Vincent [Montreal]
2007-12-12 13:05                                         ` Fortier,Vincent [Montreal]
2007-12-12 13:41                                         ` Dhaval Giani
2007-12-12 18:45                                           ` Fortier,Vincent [Montreal]
2007-12-13 11:43                                             ` Dhaval Giani
2007-12-13 12:55                                               ` Ingo Molnar
2007-12-13 13:02                                                 ` Dhaval Giani
2007-12-13 13:12                                                   ` Ingo Molnar
2007-12-13 13:43                                                     ` Vincent Fortier
2007-12-13 13:24                                                   ` Vincent Fortier
2007-12-13 14:41                                                     ` Dhaval Giani
2007-12-13 13:59                                                 ` Kay Sievers
2007-12-13 15:02                                                   ` Vincent Fortier
2007-12-13 16:23                                                     ` Kay Sievers
2007-12-13 16:50                                                       ` Ingo Molnar
2007-12-13 17:10                                                         ` Kay Sievers
2007-12-13 20:21                                                           ` Ingo Molnar
2007-12-14  2:14                                                             ` Dhaval Giani
2007-12-14 16:26                                                             ` Greg KH
2007-12-14 17:07                                                               ` Dhaval Giani
2007-12-14 17:28                                                                 ` Greg KH
2007-12-20 13:49                                                                   ` Vincent Fortier
2007-12-13 17:20                                                         ` Dhaval Giani
2007-12-11 19:31                           ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071207171455.b2eecb60.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vincent.fortier1@ec.gc.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox