Skip to content

Commit 82a3242

Browse files
committed
sysfs: remove "last sysfs file:" line from the oops messages
On some arches (x86, sh, arm, unicore, powerpc) the oops message would print out the last sysfs file accessed. This was very useful in finding a number of sysfs and driver core bugs in the 2.5 and early 2.6 development days, but it has been a number of years since this file has actually helped in debugging anything that couldn't also be trivially determined from the stack traceback. So it's time to delete the line. This is good as we need all the space we can get for oops messages at times on consoles. Acked-by: Phil Carmody <ext-phil.2.carmody@nokia.com> Acked-by: Ingo Molnar <mingo@elte.hu> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent a236c71 commit 82a3242

7 files changed

Lines changed: 0 additions & 22 deletions

File tree

‎arch/arm/kernel/traps.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ static int __die(const char *str, int err, struct thread_info *thread, struct pt
234234

235235
printk(KERN_EMERG "Internal error: %s: %x [#%d]" S_PREEMPT S_SMP "\n",
236236
str, err, ++die_counter);
237-
sysfs_printk_last_file();
238237

239238
/* trap and error numbers are mostly meaningless on ARM */
240239
ret = notify_die(DIE_OOPS, str, regs, err, tsk->thread.trap_no, SIGSEGV);

‎arch/powerpc/kernel/traps.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ int die(const char *str, struct pt_regs *regs, long err)
143143
#endif
144144
printk("%s\n", ppc_md.name ? ppc_md.name : "");
145145

146-
sysfs_printk_last_file();
147146
if (notify_die(DIE_OOPS, str, regs, err, 255,
148147
SIGSEGV) == NOTIFY_STOP)
149148
return 1;

‎arch/sh/kernel/traps_32.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ void die(const char * str, struct pt_regs * regs, long err)
8787
bust_spinlocks(1);
8888

8989
printk("%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
90-
sysfs_printk_last_file();
9190
print_modules();
9291
show_regs(regs);
9392

‎arch/unicore32/kernel/traps.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ static int __die(const char *str, int err, struct thread_info *thread,
192192

193193
printk(KERN_EMERG "Internal error: %s: %x [#%d]\n",
194194
str, err, ++die_counter);
195-
sysfs_printk_last_file();
196195

197196
/* trap and error numbers are mostly meaningless on UniCore */
198197
ret = notify_die(DIE_OOPS, str, regs, err, tsk->thread.trap_no, \

‎arch/x86/kernel/dumpstack.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ int __kprobes __die(const char *str, struct pt_regs *regs, long err)
279279
printk("DEBUG_PAGEALLOC");
280280
#endif
281281
printk("\n");
282-
sysfs_printk_last_file();
283282
if (notify_die(DIE_OOPS, str, regs, err,
284283
current->thread.trap_no, SIGSEGV) == NOTIFY_STOP)
285284
return 1;

‎fs/sysfs/file.c‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@
2424

2525
#include "sysfs.h"
2626

27-
/* used in crash dumps to help with debugging */
28-
static char last_sysfs_file[PATH_MAX];
29-
void sysfs_printk_last_file(void)
30-
{
31-
printk(KERN_EMERG "last sysfs file: %s\n", last_sysfs_file);
32-
}
33-
3427
/*
3528
* There's one sysfs_buffer for each open file and one
3629
* sysfs_open_dirent for each sysfs_dirent with one or more open
@@ -337,11 +330,6 @@ static int sysfs_open_file(struct inode *inode, struct file *file)
337330
struct sysfs_buffer *buffer;
338331
const struct sysfs_ops *ops;
339332
int error = -EACCES;
340-
char *p;
341-
342-
p = d_path(&file->f_path, last_sysfs_file, sizeof(last_sysfs_file));
343-
if (!IS_ERR(p))
344-
memmove(last_sysfs_file, p, strlen(p) + 1);
345333

346334
/* need attr_sd for attr and ops, its parent for kobj */
347335
if (!sysfs_get_active(attr_sd))

‎include/linux/sysfs.h‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd,
176176
const unsigned char *name);
177177
struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd);
178178
void sysfs_put(struct sysfs_dirent *sd);
179-
void sysfs_printk_last_file(void);
180179

181180
/* Called to clear a ns tag when it is no longer valid */
182181
void sysfs_exit_ns(enum kobj_ns_type type, const void *tag);
@@ -348,10 +347,6 @@ static inline int __must_check sysfs_init(void)
348347
return 0;
349348
}
350349

351-
static inline void sysfs_printk_last_file(void)
352-
{
353-
}
354-
355350
#endif /* CONFIG_SYSFS */
356351

357352
#endif /* _SYSFS_H_ */

0 commit comments

Comments
 (0)