Commit 232b1432 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Linus Torvalds

freezer: do not sync filesystems from freeze_processes

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: default avatarRafael J. Wysocki <rjw@sisk.pl>
Acked-by: default avatarPavel Machek <pavel@ucw.cz>
Cc: Nigel Cunningham <nigel@nigel.suspend2.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 27763653
...@@ -313,6 +313,10 @@ int hibernate(void) ...@@ -313,6 +313,10 @@ int hibernate(void)
if (error) if (error)
goto Exit; goto Exit;
printk("Syncing filesystems ... ");
sys_sync();
printk("done.\n");
error = prepare_processes(); error = prepare_processes();
if (error) if (error)
goto Finish; goto Finish;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/resume-trace.h> #include <linux/resume-trace.h>
#include <linux/freezer.h> #include <linux/freezer.h>
#include <linux/vmstat.h> #include <linux/vmstat.h>
#include <linux/syscalls.h>
#include "power.h" #include "power.h"
...@@ -230,9 +231,14 @@ static int enter_state(suspend_state_t state) ...@@ -230,9 +231,14 @@ static int enter_state(suspend_state_t state)
if (!valid_state(state)) if (!valid_state(state))
return -ENODEV; return -ENODEV;
if (!mutex_trylock(&pm_mutex)) if (!mutex_trylock(&pm_mutex))
return -EBUSY; return -EBUSY;
printk("Syncing filesystems ... ");
sys_sync();
printk("done.\n");
pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]); pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]);
if ((error = suspend_prepare())) if ((error = suspend_prepare()))
goto Unlock; goto Unlock;
......
...@@ -191,7 +191,6 @@ int freeze_processes(void) ...@@ -191,7 +191,6 @@ int freeze_processes(void)
if (error) if (error)
return error; return error;
sys_sync();
error = try_to_freeze_tasks(FREEZER_KERNEL_THREADS); error = try_to_freeze_tasks(FREEZER_KERNEL_THREADS);
if (error) if (error)
return error; return error;
......
...@@ -153,6 +153,10 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp, ...@@ -153,6 +153,10 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
mutex_lock(&pm_mutex); mutex_lock(&pm_mutex);
error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE); error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
if (!error) { if (!error) {
printk("Syncing filesystems ... ");
sys_sync();
printk("done.\n");
error = freeze_processes(); error = freeze_processes();
if (error) if (error)
thaw_processes(); thaw_processes();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment