Software Suspend 2.4 beta18-1.1rc4: Possible hard disk corruption

From: Nigel Cunningham
Date: Mon Aug 18 2003 - 20:35:39 EST


Hi all.

The following patch fixes possible hard disk corruption in versions
beta18 through 1.1-rc4 (inclusive) of Software Suspend for 2.4 kernels.
Software Suspend for 2.5/6 is not affected.

Corruption can occur if you have unsynced data when starting to suspend
and that data is overwritten by Software Suspend in the normal course of
its operation and then the kernel attempts to sync data due to a panic
or you pressing the appropriate SysRq keys. This patch addresses those
issues.

All users should apply this portion of the incremental patch for 1.1-rc5
immediately.

Regards and apologies,

Nigel

diff -ruN swsusp-1.1-rc4/drivers/char/sysrq.c swsusp-1.1-rc5/drivers/char/sysrq.c
--- swsusp-1.1-rc4/drivers/char/sysrq.c 2003-08-19 13:05:43.000000000 +1200
+++ swsusp-1.1-rc5/drivers/char/sysrq.c 2003-08-19 13:05:44.000000000 +1200
@@ -139,8 +139,19 @@
static void go_sync(struct super_block *sb, int remount_flag)
{
int orig_loglevel;
+
+#ifdef CONFIG_SOFTWARE_SUSPEND
+ if (suspend_task) {
+ printk(KERN_INFO "Not %sing device %s. Suspend may have used memory with dirty data!",
+ remount_flag ? "remount" : "sync",
+ kdevname(sb->s_dev));
+ return;
+ }
+#endif
+
orig_loglevel = console_loglevel;
console_loglevel = 7;
+
printk(KERN_INFO "%sing device %s ... ",
remount_flag ? "Remount" : "Sync",
kdevname(sb->s_dev));
diff -ruN swsusp-1.1-rc4/kernel/panic.c swsusp-1.1-rc5/kernel/panic.c
--- swsusp-1.1-rc4/kernel/panic.c 2003-08-19 13:05:43.000000000 +1200
+++ swsusp-1.1-rc5/kernel/panic.c 2003-08-19 13:05:44.000000000 +1200
@@ -16,6 +16,7 @@
#include <linux/init.h>
#include <linux/sysrq.h>
#include <linux/interrupt.h>
+#include <linux/suspend.h>

asmlinkage void sys_sync(void); /* it's really int */

@@ -58,6 +59,10 @@
printk(KERN_EMERG "In interrupt handler - not syncing\n");
else if (!current->pid)
printk(KERN_EMERG "In idle task - not syncing\n");
+#ifdef CONFIG_SOFTWARE_SUSPEND
+ else if (suspend_task)
+ printk(KERN_EMERG "In software suspend - not syncing.\n");
+#endif
else
sys_sync();
bust_spinlocks(0);



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