journal_info = current->journal_info;
current->journal_info = NULL;
sprintf(debug_file_name, "%s.%ld", debug_file_path, CURRENT_SECONDS);
- file = filp_open(debug_file_name, O_CREAT|O_TRUNC|O_RDWR, 0644);
+ file = filp_open(debug_file_name, O_CREAT|O_EXCL|O_RDWR, 0644);
if (!file || IS_ERR(file)) {
CERROR("cannot open %s for dumping: %ld\n", debug_file_name,
return str;
}
+#ifdef __KERNEL__
+#include <linux/lustre_version.h>
+#if (LUSTRE_KERNEL_VERSION >= 30)
+#warning "FIXME: remove workaround when l30 is widely used"
char stack_backtrace[LUSTRE_TRACE_SIZE];
spinlock_t stack_backtrace_lock = SPIN_LOCK_UNLOCKED;
#if defined(__arch_um__)
-# warning in arch_um
extern int is_kernel_text_address(unsigned long addr);
char *buf = stack_backtrace;
char *pbuf = buf;
unsigned long *stack = (unsigned long *)&buf;
-
+
size = sprintf(pbuf, " Call Trace: ");
pbuf += size;
while (((long) stack & (THREAD_SIZE-1)) != 0) {
break;
}
}
-
+
return buf;
}
#elif defined(CONFIG_X86)
-# warning in __i386__
extern int is_kernel_text_address(unsigned long addr);
extern int lookup_symbol(unsigned long address, char *buf, int buflen);
char *portals_debug_dumpstack(void)
{
- unsigned long esp = current->thread.esp;
+ unsigned long esp = current->thread.esp;
unsigned long *stack = (unsigned long *)&esp;
int size;
unsigned long addr;
char *buf = stack_backtrace;
char *pbuf = buf;
static char buffer[512];
-
- /* User space on another CPU? */
- if ((esp ^ (unsigned long)current) & (PAGE_MASK<<1)){
- memset(buf, 0x0, LUSTRE_TRACE_SIZE);
+
+ /* User space on another CPU? */
+ if ((esp ^ (unsigned long)current) & (PAGE_MASK<<1)){
+ buf[0] = '\0';
goto out;
}
-
+
size = sprintf(pbuf, " Call Trace: ");
pbuf += size;
while (((long) stack & (THREAD_SIZE-1)) != 0) {
char *portals_debug_dumpstack(void)
{
char *buf = stack_backtrace;
- memset(buf, 0x0, LUSTRE_TRACE_SIZE);
+ buf[0] = '\0';
return buf;
}
#endif /* __arch_um__ */
+EXPORT_SYMBOL(stack_backtrace_lock);
+EXPORT_SYMBOL(portals_debug_dumpstack);
+#endif /* LUSTRE_KERNEL_VERSION < 30 */
+#endif /* __KERNEL__ */
EXPORT_SYMBOL(portals_debug_dumplog);
EXPORT_SYMBOL(portals_debug_msg);
EXPORT_SYMBOL(portals_run_upcall);
EXPORT_SYMBOL(portals_run_lbug_upcall);
EXPORT_SYMBOL(portals_nid2str);
-EXPORT_SYMBOL(portals_debug_dumpstack);
-EXPORT_SYMBOL(stack_backtrace_lock);
journal_info = current->journal_info;
current->journal_info = NULL;
sprintf(debug_file_name, "%s.%ld", debug_file_path, CURRENT_SECONDS);
- file = filp_open(debug_file_name, O_CREAT|O_TRUNC|O_RDWR, 0644);
+ file = filp_open(debug_file_name, O_CREAT|O_EXCL|O_RDWR, 0644);
if (!file || IS_ERR(file)) {
CERROR("cannot open %s for dumping: %ld\n", debug_file_name,
return str;
}
+#ifdef __KERNEL__
+#include <linux/lustre_version.h>
+#if (LUSTRE_KERNEL_VERSION >= 30)
+#warning "FIXME: remove workaround when l30 is widely used"
char stack_backtrace[LUSTRE_TRACE_SIZE];
spinlock_t stack_backtrace_lock = SPIN_LOCK_UNLOCKED;
#if defined(__arch_um__)
-# warning in arch_um
extern int is_kernel_text_address(unsigned long addr);
char *buf = stack_backtrace;
char *pbuf = buf;
unsigned long *stack = (unsigned long *)&buf;
-
+
size = sprintf(pbuf, " Call Trace: ");
pbuf += size;
while (((long) stack & (THREAD_SIZE-1)) != 0) {
break;
}
}
-
+
return buf;
}
#elif defined(CONFIG_X86)
-# warning in __i386__
extern int is_kernel_text_address(unsigned long addr);
extern int lookup_symbol(unsigned long address, char *buf, int buflen);
char *portals_debug_dumpstack(void)
{
- unsigned long esp = current->thread.esp;
+ unsigned long esp = current->thread.esp;
unsigned long *stack = (unsigned long *)&esp;
int size;
unsigned long addr;
char *buf = stack_backtrace;
char *pbuf = buf;
static char buffer[512];
-
- /* User space on another CPU? */
- if ((esp ^ (unsigned long)current) & (PAGE_MASK<<1)){
- memset(buf, 0x0, LUSTRE_TRACE_SIZE);
+
+ /* User space on another CPU? */
+ if ((esp ^ (unsigned long)current) & (PAGE_MASK<<1)){
+ buf[0] = '\0';
goto out;
}
-
+
size = sprintf(pbuf, " Call Trace: ");
pbuf += size;
while (((long) stack & (THREAD_SIZE-1)) != 0) {
char *portals_debug_dumpstack(void)
{
char *buf = stack_backtrace;
- memset(buf, 0x0, LUSTRE_TRACE_SIZE);
+ buf[0] = '\0';
return buf;
}
#endif /* __arch_um__ */
+EXPORT_SYMBOL(stack_backtrace_lock);
+EXPORT_SYMBOL(portals_debug_dumpstack);
+#endif /* LUSTRE_KERNEL_VERSION < 30 */
+#endif /* __KERNEL__ */
EXPORT_SYMBOL(portals_debug_dumplog);
EXPORT_SYMBOL(portals_debug_msg);
EXPORT_SYMBOL(portals_run_upcall);
EXPORT_SYMBOL(portals_run_lbug_upcall);
EXPORT_SYMBOL(portals_nid2str);
-EXPORT_SYMBOL(portals_debug_dumpstack);
-EXPORT_SYMBOL(stack_backtrace_lock);