]> err.no Git - linux-2.6/commitdiff
freezer: do not sync filesystems from freeze_processes
authorRafael J. Wysocki <rjw@sisk.pl>
Thu, 18 Oct 2007 10:04:44 +0000 (03:04 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 18 Oct 2007 21:37:18 +0000 (14:37 -0700)
The syncing of filesystems from within the freezer is generally not needed.
Also, if there's an ext3 filesystem loopback-mounted from a FUSE one, the
syncing results in writes to it and deadlocks.  Similarly, it will deadlock if
FUSE implements sync.

Change freeze_processes() so that it doesn't execute sys_sync() and make the
suspend and hibernation code path sync filesystems independently of the
freezer.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: Nigel Cunningham <nigel@nigel.suspend2.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/power/disk.c
kernel/power/main.c
kernel/power/process.c
kernel/power/user.c

index 9348d95a4fb81c96c4a37e657dc4187467aadc78..555c0f0b2f7eaa20110b57064cb5f701b4e764df 100644 (file)
@@ -313,6 +313,10 @@ int hibernate(void)
        if (error)
                goto Exit;
 
+       printk("Syncing filesystems ... ");
+       sys_sync();
+       printk("done.\n");
+
        error = prepare_processes();
        if (error)
                goto Finish;
index fb2412e7a0ce2ca7cedd858b3aa47f94eb7d285c..3cdf95b1dc92af97e13e8a6c68c4e0a6f8d42153 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/resume-trace.h>
 #include <linux/freezer.h>
 #include <linux/vmstat.h>
+#include <linux/syscalls.h>
 
 #include "power.h"
 
@@ -230,9 +231,14 @@ static int enter_state(suspend_state_t state)
 
        if (!valid_state(state))
                return -ENODEV;
+
        if (!mutex_trylock(&pm_mutex))
                return -EBUSY;
 
+       printk("Syncing filesystems ... ");
+       sys_sync();
+       printk("done.\n");
+
        pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]);
        if ((error = suspend_prepare()))
                goto Unlock;
index 3434940a3df175679e4391f94755f09431c864c1..dba2f3acb4f802289e7399ee1e758d780267453c 100644 (file)
@@ -191,7 +191,6 @@ int freeze_processes(void)
        if (error)
                return error;
 
-       sys_sync();
        error = try_to_freeze_tasks(FREEZER_KERNEL_THREADS);
        if (error)
                return error;
index bd0723a7df3f99cf811834f9cc1d107202d46947..5bd321bcbb75f06031d6ede749cad599c251373c 100644 (file)
@@ -153,6 +153,10 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
                mutex_lock(&pm_mutex);
                error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
                if (!error) {
+                       printk("Syncing filesystems ... ");
+                       sys_sync();
+                       printk("done.\n");
+
                        error = freeze_processes();
                        if (error)
                                thaw_processes();