[OpenAFS-devel] Kernel panic with openafs 1.4.0
chas williams - CONTRACTOR
chas@cmf.nrl.navy.mil
Thu, 24 Aug 2006 17:16:00 -0400
In message <6ADBBF2C8662EF0941226A0F@sirius.fac.cs.cmu.edu>,Jeffrey Hutzelman w
rites:
>There's nothing to fix. osi_Panic _does_ print out the message string, but
>necessarily does so _before_ it calls BUG(). Which means that users
>habitually don't actually copy the message when sending in a report.
>Fixing this would require changes to Linux to allow something calling BUG
>to include a message that gets included _below_ the "cut here" line.
well could fix it by making BUG() do something else and actually point
out the line where the trouble occurred. so when we get these truncated
kernel panics (they are following the directions after all) we might
be able to do something with them. we arent going to be able to
change BUG() and we probably cant change all the users in the world.
you could also make osi_Panic() print "REALLY CUT FROM HERE" but that's
even sillier.
i am particularly awed by AFS_ASSERT_GLOCK(). i had never seen that
before.
Index: src/rx/rx_prototypes.h
===================================================================
--- src/rx/rx_prototypes.h (revision 11)
+++ src/rx/rx_prototypes.h (revision 12)
@@ -325,7 +325,11 @@
extern void rxk_shutdownPorts(void);
extern osi_socket rxi_GetUDPSocket(u_short port);
extern osi_socket rxi_GetHostUDPSocket(u_int host, u_short port);
-extern void osi_Panic();
+#if defined(KERNEL) && defined(AFS_LINUX24_ENV)
+#define osi_Panic(msg...) do { printk(KERN_CRIT "openafs: " msg); BUG(); } while (0)
+#else
+extern void osi_Panic(); /* leave without args till stdarg rewrite */
+#endif
extern int osi_utoa(char *buf, size_t len, unsigned long val);
extern void rxi_InitPeerParams(register struct rx_peer *pp);
extern void shutdown_rxkernel(void);
@@ -556,7 +560,6 @@
extern osi_socket rxi_GetUDPSocket(u_short port);
extern void osi_AssertFailU(const char *expr, const char *file, int line);
extern int rx_getAllAddr(afs_int32 * buffer, int maxSize);
-extern void osi_Panic(); /* leave without args till stdarg rewrite */
extern void rxi_InitPeerParams(struct rx_peer *pp);
#if defined(AFS_AIX32_ENV) && !defined(KERNEL)
Index: src/rx/rx_kcommon.c
===================================================================
--- src/rx/rx_kcommon.c (revision 11)
+++ src/rx/rx_kcommon.c (revision 12)
@@ -124,6 +124,7 @@
return rxi_GetHostUDPSocket(htonl(INADDR_ANY), port);
}
+#if !defined(AFS_LINUX24_ENV)
void
osi_Panic(msg, a1, a2, a3)
char *msg;
@@ -132,12 +133,13 @@
msg = "Unknown AFS panic";
printf(msg, a1, a2, a3);
-#ifdef AFS_LINUX24_ENV
+#ifdef AFS_LINUX20_ENV
* ((char *) 0) = 0;
#else
panic(msg);
#endif
}
+#endif
/*
* osi_utoa() - write the NUL-terminated ASCII decimal form of the given
@@ -228,6 +230,9 @@
static const char msg2[] = ", line: ";
static const char msg3[] = "\n";
+#if defined(AFS_LINUX24_ENV)
+ osi_Panic("%s%s%s%s%s%d%s", msg0, expr, msg1, file, msg2, line, msg3);
+#else
/*
* These buffers add up to 1K, which is a pleasantly nice round
* value, but probably not vital.
@@ -260,6 +265,7 @@
#undef ADDBUF
osi_Panic(buf);
+#endif
}
#ifndef UKERNEL
Index: src/afs/afs_osi.h
===================================================================
--- src/afs/afs_osi.h (revision 11)
+++ src/afs/afs_osi.h (revision 12)
@@ -220,7 +220,7 @@
#ifdef AFS_GLOBAL_SUNLOCK
#define AFS_ASSERT_GLOCK() \
- (ISAFS_GLOCK() || (osi_Panic("afs global lock not held at %s:%d\n", __FILE__, __LINE__), 0))
+ if (!ISAFS_GLOCK()) osi_Panic("afs global lock not held at %s:%d\n", __FILE__, __LINE__)
#endif /* AFS_GLOBAL_SUNLOCK */
#ifdef RX_ENABLE_LOCKS