Software Suspend 2.4 beta18-1.1rc4: Possible hard disk corruption
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
drivers/char/sysrq.c +11 -0
@@ -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));
kernel/panic.c +5 -0
@@ -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 elsesys_sync ();bust_spinlocks (0 );