From 5dba7057b667bfdf6f70775d0551883eb2ae67a5 Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Thu, 14 Oct 2004 09:10:46 +1000 Subject: [PATCH] [XFS] Fix regression when running in laptop mode, causes hangs on sync. SGI Modid: xfs-linux:xfs-kern:19744a Signed-off-by: Nathan Scott --- fs/xfs/linux-2.6/xfs_super.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index 20bfe72284978..854b656c98bc0 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c @@ -491,8 +491,14 @@ xfssyncd( break; spin_lock(&vfsp->vfs_sync_lock); - if (!timeleft) { - timeleft = (xfs_syncd_centisecs * HZ) / 100; + /* + * We can get woken by laptop mode, to do a sync - + * that's the (only!) case where the list would be + * empty with time remaining. + */ + if (!timeleft || list_empty(&vfsp->vfs_sync_list)) { + if (!timeleft) + timeleft = (xfs_syncd_centisecs * HZ) / 100; INIT_LIST_HEAD(&vfsp->vfs_sync_work.w_list); list_add_tail(&vfsp->vfs_sync_work.w_list, &vfsp->vfs_sync_list); @@ -595,9 +601,10 @@ linvfs_sync_super( if (unlikely(laptop_mode)) { int prev_sync_seq = vfsp->vfs_sync_seq; + /* * The disk must be active because we're syncing. - * We schedule syncd now (now that the disk is + * We schedule xfssyncd now (now that the disk is * active) instead of later (when it might not be). */ wake_up_process(vfsp->vfs_sync_task); -- 2.53.0