Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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;
+6 −0
Original line number Diff line number Diff line
@@ -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;
+0 −1
Original line number Diff line number Diff line
@@ -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;
+4 −0
Original line number Diff line number Diff line
@@ -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();