Received: by 10.223.185.116 with SMTP id b49csp6347607wrg; Wed, 28 Feb 2018 07:59:29 -0800 (PST) X-Google-Smtp-Source: AH8x226tKkuQXBms0Ar1lj/4h89HYkliJwzPqBZO/JuFZFdUwpRx0jVIlA7HZByfyN9xTYBKFkRD X-Received: by 10.98.214.218 with SMTP id a87mr18234776pfl.146.1519833569816; Wed, 28 Feb 2018 07:59:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519833569; cv=none; d=google.com; s=arc-20160816; b=w8rD8vJiW5FTRJkWlS3jKVorhdYhT9WwnxUX+yQk9KeE33DY4NxXdLmh0JW+ak05wG AlkwAc8vIEV7N86asluYnnZlb+1jt8sW1jW2Grd3z0kIfoBlAT3Af98PkmSGZlDYds0z s6BDf9BVZVAfvfGkOBS+mv561+HMukMj0dv5v5n7CorjWf4Q/OSp8v0U1h1+qm6MXj+0 c0lw84jFA6NXfg6ZlTXTsU6d2ZC/Pf9UI3j0lQbbBgmSPe1a6VZSBZ6js2nbjoEe5DIc /sIMzbXTi4quSpJ2P6HxCuNbvHdEfBTREBs/358kiVQdVV8K3eG1VpZLg84EsRFJNR+6 7Vjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=+z8eiW8d1FU66R9S0Xm9/Mu+gA3FHJuM/kZHwaB3chQ=; b=gZ+Q0NF44uIaxO5Zb9bHDRPU89O4z2uucaamL8ZayJFuGDGI8LjVlTA8Tt0lQXhRuc 7lVTw8qFlOOKf1M6zYSHiSTET3J6JjlMf1WgqHMTo9G/WjFnm54YMrHAWNXQ/Hfkfhaf IEATnjdX5lXO5mo1B8TQCK+xbC4kMBE5D+CYu45+IuSqyycUbZoSThs4oz516SGFTaIp BMmjaEKh0UhlgZKBoC1D7IQ41bSAEHd40idn6dJ70SDW+BhHSTqsGLrpG/x5iVu5qj8s VH/5eOmds7Vss8M5+D4FPEPmU7+lMnQ9CKh67z1+ZmbPl39S92ifjseeGI4Wet/Gggcp wXVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h14si1361656pfd.404.2018.02.28.07.59.14; Wed, 28 Feb 2018 07:59:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752892AbeB1P5O (ORCPT + 99 others); Wed, 28 Feb 2018 10:57:14 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34502 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934011AbeB1P47 (ORCPT ); Wed, 28 Feb 2018 10:56:59 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yr-0006Xk-B1; Wed, 28 Feb 2018 15:22:29 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yi-0000Ah-4f; Wed, 28 Feb 2018 15:22:20 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Marc Dionne" , "Al Viro" , "David Howells" , "Jeff Layton" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 154/254] fscache: Fix the default for fscache_maybe_release_page() In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: David Howells 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 Signed-off-by: David Howells Reviewed-by: Jeff Layton Acked-by: Al Viro Tested-by: Marc Dionne Signed-off-by: Ben Hutchings --- include/linux/fscache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/include/linux/fscache.h +++ b/include/linux/fscache.h @@ -764,7 +764,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; } /**