commit:     4f63d91e3dadb1e5e18b235d059ad2d511d65406
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 14 14:46:07 2017 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Sat Jan 14 14:46:07 2017 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=4f63d91e

xfs: Make xfsaild freezeable again. See bug #575034.

 0000_README                          |  4 ++
 1900_xfs-fix-suspend-to-memory.patch | 78 ++++++++++++++++++++++++++++++++++++
 2 files changed, 82 insertions(+)

diff --git a/0000_README b/0000_README
index 94751c6..335640e 100644
--- a/0000_README
+++ b/0000_README
@@ -219,6 +219,10 @@ Patch:  
1510_fs-enable-link-security-restrictions-by-default.patch
 From:   
http://sources.debian.net/src/linux/3.16.7-ckt4-3/debian/patches/debian/fs-enable-link-security-restrictions-by-default.patch/
 Desc:   Enable link security restrictions by default.
 
+Patch:  1900_xfs-fix-suspend-to-memory.patch
+From:   
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/patch/fs/xfs/xfs_trans_ail.c?id=18f1df4e00cea2eae41f3e5515b94d1e7127b2b6
+Desc:   xfs: Make xfsaild freezeable again. See bug #575034.
+
 Patch:  2700_ThinkPad-30-brightness-control-fix.patch
 From:   Seth Forshee <[email protected]>
 Desc:   ACPI: Disable Windows 8 compatibility for some Lenovo ThinkPads.

diff --git a/1900_xfs-fix-suspend-to-memory.patch 
b/1900_xfs-fix-suspend-to-memory.patch
new file mode 100644
index 0000000..1383702
--- /dev/null
+++ b/1900_xfs-fix-suspend-to-memory.patch
@@ -0,0 +1,78 @@
+From 18f1df4e00cea2eae41f3e5515b94d1e7127b2b6 Mon Sep 17 00:00:00 2001
+From: Michal Hocko <[email protected]>
+Date: Mon, 8 Feb 2016 14:59:07 +1100
+Subject: xfs: Make xfsaild freezeable again
+
+Hendik has reported suspend failures due to xfsaild blocking the freezer
+to settle down.
+Jan 17 19:59:56 linux-6380 kernel: PM: Syncing filesystems ... done.
+Jan 17 19:59:56 linux-6380 kernel: PM: Preparing system for sleep (mem)
+Jan 17 19:59:56 linux-6380 kernel: Freezing user space processes ... (elapsed 
0.001 seconds) done.
+Jan 17 19:59:56 linux-6380 kernel: Freezing remaining freezable tasks ...
+Jan 17 19:59:56 linux-6380 kernel: Freezing of tasks failed after 20.002 
seconds (1 tasks refusing to freeze, wq_busy=0):
+Jan 17 19:59:56 linux-6380 kernel: xfsaild/dm-5    S 00000000     0  1293      
2 0x00000080
+Jan 17 19:59:56 linux-6380 kernel:  f0ef5f00 00000046 00000200 00000000 
ffff9022 c02d3800 00000000 00000032
+Jan 17 19:59:56 linux-6380 kernel:  ee0b2400 00000032 f71e0d00 f36fabc0 
f0ef2d00 f0ef6000 f0ef2d00 f12f90c0
+Jan 17 19:59:56 linux-6380 kernel:  f0ef5f0c c0844e44 00000000 f0ef5f6c 
f811e0be 00000000 00000000 f0ef2d00
+Jan 17 19:59:56 linux-6380 kernel: Call Trace:
+Jan 17 19:59:56 linux-6380 kernel:  [<c0844e44>] schedule+0x34/0x90
+Jan 17 19:59:56 linux-6380 kernel:  [<f811e0be>] xfsaild+0x5de/0x600 [xfs]
+Jan 17 19:59:56 linux-6380 kernel:  [<c0286cbb>] kthread+0x9b/0xb0
+Jan 17 19:59:56 linux-6380 kernel:  [<c0848a79>] 
ret_from_kernel_thread+0x21/0x38
+
+The issue has been there for quite some time but it has been made
+visible by only by 24ba16bb3d49 ("xfs: clear PF_NOFREEZE for xfsaild
+kthread") because the suspend started seeing xfsaild.
+
+The above commit has missed that the !xfs_ail_min branch might call
+schedule with TASK_INTERRUPTIBLE without calling try_to_freeze so the pm
+suspend would wake up the kernel thread over and over again without any
+progress. What we want here is to use freezable_schedule instead to hide
+the thread from the suspend.
+
+While we are here also change schedule_timeout to freezable variant to
+prevent from spurious wakeups by suspend.
+
+[dchinner: re-add set_freezeable call so the freezer will account properly
+ for this kthread. ]
+
+Reported-by: Hendrik Woltersdorf <[email protected]>
+Signed-off-by: Michal Hocko <[email protected]>
+Reviewed-by: Dave Chinner <[email protected]>
+Signed-off-by: Dave Chinner <[email protected]>
+---
+ fs/xfs/xfs_trans_ail.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/fs/xfs/xfs_trans_ail.c b/fs/xfs/xfs_trans_ail.c
+index 4f18fd9..d6c9c3e 100644
+--- a/fs/xfs/xfs_trans_ail.c
++++ b/fs/xfs/xfs_trans_ail.c
+@@ -497,6 +497,7 @@ xfsaild(
+       long            tout = 0;       /* milliseconds */
+ 
+       current->flags |= PF_MEMALLOC;
++      set_freezable();
+ 
+       while (!kthread_should_stop()) {
+               if (tout && tout <= 20)
+@@ -519,14 +520,14 @@ xfsaild(
+               if (!xfs_ail_min(ailp) &&
+                   ailp->xa_target == ailp->xa_target_prev) {
+                       spin_unlock(&ailp->xa_lock);
+-                      schedule();
++                      freezable_schedule();
+                       tout = 0;
+                       continue;
+               }
+               spin_unlock(&ailp->xa_lock);
+ 
+               if (tout)
+-                      schedule_timeout(msecs_to_jiffies(tout));
++                      freezable_schedule_timeout(msecs_to_jiffies(tout));
+ 
+               __set_current_state(TASK_RUNNING);
+ 
+-- 
+cgit v0.12
+

Reply via email to