[PATCH] Fix sysrq/panic for gcc 3.1

Andi Kleen (ak@muc.de)
Sat, 20 Apr 2002 18:33:23 +0200


Without this patch a loop checking for emergency_sync_scheduled in panic() is optimized
away by gcc 3.1, which causes hangs in panic.

-Andi

diff -X ../../KDIFX -x *-o -x *-RESERVE -burpN ../../v2.5/linux/drivers/char/sysrq.c linux/drivers/char/sysrq.c
--- ../../v2.5/linux/drivers/char/sysrq.c Thu Mar 28 10:06:16 2002
+++ linux/drivers/char/sysrq.c Fri Apr 12 18:32:46 2002
@@ -186,7 +186,7 @@ static void go_sync(struct super_block *
* block devices and malfunctional network filesystems.
*/

-int emergency_sync_scheduled;
+volatile int emergency_sync_scheduled;

void do_emergency_sync(void) {
struct super_block *sb;
diff -X ../../KDIFX -x *-o -x *-RESERVE -burpN ../../v2.5/linux/include/linux/sysrq.h linux/include/linux/sysrq.h
--- ../../v2.5/linux/include/linux/sysrq.h Wed Apr 17 13:33:34 2002
+++ linux/include/linux/sysrq.h Sat Apr 20 16:12:00 2002
@@ -103,7 +103,7 @@ static inline int __reterr(void)

/* Deferred actions */

-extern int emergency_sync_scheduled;
+extern volatile int emergency_sync_scheduled;

#define EMERG_SYNC 1
#define EMERG_REMOUNT 2
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/