public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nigel Cunningham <ncunningham@clear.net.nz>
To: swsusp-devel <swsusp-devel@lists.sourceforge.net>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Software Suspend 2.4 beta18-1.1rc4: Possible hard disk corruption
Date: Tue, 19 Aug 2003 13:23:42 +1200	[thread overview]
Message-ID: <1061256163.9992.7.camel@laptop-linux> (raw)

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);




                 reply	other threads:[~2003-08-19  1:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1061256163.9992.7.camel@laptop-linux \
    --to=ncunningham@clear.net.nz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=swsusp-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox