From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Rafael J. Wysocki" Subject: [RFC][PATCH -mm 2/7] Freezer: Do not sync filesystems from freeze_processes Date: Thu, 12 Jul 2007 00:10:43 +0200 Message-ID: <200707120010.44482.rjw@sisk.pl> References: <200707120006.50095.rjw@sisk.pl> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <200707120006.50095.rjw@sisk.pl> Content-Disposition: inline List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org To: pm list Cc: Matthew Garrett , Oleg Nesterov , Pavel Machek , Miklos Szeredi List-Id: linux-pm@vger.kernel.org From: Rafael J. Wysocki The syncing of filesystems from within the freezer is generally not neede= d. Also, if there's an ext3 filesystem loopback-mounted from a FUSE one, the syncing results in writes to it and deadlocks. =A0Similarly, it will dead= lock if FUSE implements sync. Change freeze_processes() so that it doesn't execute sys_sync() and make = the suspend and hibernation code paths sync filesystems independently of the freezer. Signed-off-by: Rafael J. Wysocki --- kernel/power/disk.c | 4 ++++ kernel/power/main.c | 6 ++++++ kernel/power/process.c | 1 - kernel/power/user.c | 4 ++++ 4 files changed, 14 insertions(+), 1 deletion(-) Index: linux-2.6.22-rc6-mm1/kernel/power/disk.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- linux-2.6.22-rc6-mm1.orig/kernel/power/disk.c 2007-07-11 20:48:05.000= 000000 +0200 +++ linux-2.6.22-rc6-mm1/kernel/power/disk.c 2007-07-11 20:48:23.00000000= 0 +0200 @@ -297,6 +297,10 @@ int hibernate(void) if (error) goto Exit; =20 + printk("Syncing filesystems ... "); + sys_sync(); + printk("done.\n"); + error =3D prepare_processes(); if (error) goto Finish; Index: linux-2.6.22-rc6-mm1/kernel/power/main.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- linux-2.6.22-rc6-mm1.orig/kernel/power/main.c 2007-07-11 20:48:05.000= 000000 +0200 +++ linux-2.6.22-rc6-mm1/kernel/power/main.c 2007-07-11 20:48:23.00000000= 0 +0200 @@ -20,6 +20,7 @@ #include #include #include +#include =20 #include "power.h" =20 @@ -234,9 +235,14 @@ static int enter_state(suspend_state_t s =20 if (!valid_state(state)) return -ENODEV; + if (!mutex_trylock(&pm_mutex)) return -EBUSY; =20 + printk("Syncing filesystems ... "); + sys_sync(); + printk("done.\n"); + pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]); if ((error =3D suspend_prepare())) goto Unlock; Index: linux-2.6.22-rc6-mm1/kernel/power/process.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- linux-2.6.22-rc6-mm1.orig/kernel/power/process.c 2007-07-11 20:48:05.= 000000000 +0200 +++ linux-2.6.22-rc6-mm1/kernel/power/process.c 2007-07-11 20:48:23.00000= 0000 +0200 @@ -191,7 +191,6 @@ int freeze_processes(void) if (error) return error; =20 - sys_sync(); error =3D try_to_freeze_tasks(FREEZER_KERNEL_THREADS); if (error) return error; Index: linux-2.6.22-rc6-mm1/kernel/power/user.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- linux-2.6.22-rc6-mm1.orig/kernel/power/user.c 2007-07-11 20:48:05.000= 000000 +0200 +++ linux-2.6.22-rc6-mm1/kernel/power/user.c 2007-07-11 20:48:23.00000000= 0 +0200 @@ -153,6 +153,10 @@ static int snapshot_ioctl(struct inode * mutex_lock(&pm_mutex); error =3D pm_notifier_call_chain(PM_HIBERNATION_PREPARE); if (!error) { + printk("Syncing filesystems ... "); + sys_sync(); + printk("done.\n"); + error =3D freeze_processes(); if (error) thaw_processes();