]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Jan 2018 22:25:33 +0000 (23:25 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Jan 2018 22:25:33 +0000 (23:25 +0100)
added patches:
fscache-fix-the-default-for-fscache_maybe_release_page.patch

queue-4.14/fscache-fix-the-default-for-fscache_maybe_release_page.patch [new file with mode: 0644]
queue-4.14/series

diff --git a/queue-4.14/fscache-fix-the-default-for-fscache_maybe_release_page.patch b/queue-4.14/fscache-fix-the-default-for-fscache_maybe_release_page.patch
new file mode 100644 (file)
index 0000000..4b2f9d6
--- /dev/null
@@ -0,0 +1,51 @@
+From 98801506552593c9b8ac11021b0cdad12cab4f6b Mon Sep 17 00:00:00 2001
+From: David Howells <dhowells@redhat.com>
+Date: Tue, 2 Jan 2018 10:02:19 +0000
+Subject: fscache: Fix the default for fscache_maybe_release_page()
+
+From: David Howells <dhowells@redhat.com>
+
+commit 98801506552593c9b8ac11021b0cdad12cab4f6b upstream.
+
+Fix the default for fscache_maybe_release_page() for when the cookie isn't
+valid or the page isn't cached.  It mustn't return false as that indicates
+the page cannot yet be freed.
+
+The problem with the default is that if, say, there's no cache, but a
+network filesystem's pages are using up almost all the available memory, a
+system can OOM because the filesystem ->releasepage() op will not allow
+them to be released as fscache_maybe_release_page() incorrectly prevents
+it.
+
+This can be tested by writing a sequence of 512MiB files to an AFS mount.
+It does not affect NFS or CIFS because both of those wrap the call in a
+check of PG_fscache and it shouldn't bother Ceph as that only has
+PG_private set whilst writeback is in progress.  This might be an issue for
+9P, however.
+
+Note that the pages aren't entirely stuck.  Removing a file or unmounting
+will clear things because that uses ->invalidatepage() instead.
+
+Fixes: 201a15428bd5 ("FS-Cache: Handle pages pending storage that get evicted under OOM conditions")
+Reported-by: Marc Dionne <marc.dionne@auristor.com>
+Signed-off-by: David Howells <dhowells@redhat.com>
+Reviewed-by: Jeff Layton <jlayton@redhat.com>
+Acked-by: Al Viro <viro@zeniv.linux.org.uk>
+Tested-by: Marc Dionne <marc.dionne@auristor.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/fscache.h |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/include/linux/fscache.h
++++ b/include/linux/fscache.h
+@@ -755,7 +755,7 @@ bool fscache_maybe_release_page(struct f
+ {
+       if (fscache_cookie_valid(cookie) && PageFsCache(page))
+               return __fscache_maybe_release_page(cookie, page, gfp);
+-      return false;
++      return true;
+ }
+ /**
index beae79ebe0921ac4700047ba599e63742d121805..9154c682fde7f5d211b8fbd3f371a299c3052018 100644 (file)
@@ -18,3 +18,4 @@ crypto-chelsio-select-crypto_gf128mul.patch
 drm-i915-disable-dc-states-around-gmbus-on-glk.patch
 drm-i915-apply-display-wa-1183-on-skl-kbl-and-cfl.patch
 sunxi-rsb-include-of-based-modalias-in-device-uevent.patch
+fscache-fix-the-default-for-fscache_maybe_release_page.patch