From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C0E4C48BE8 for ; Mon, 14 Jun 2021 21:19:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C06AC61209 for ; Mon, 14 Jun 2021 21:19:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C06AC61209 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 21CB76B006C; Mon, 14 Jun 2021 17:19:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1CC216B006E; Mon, 14 Jun 2021 17:19:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01E946B0071; Mon, 14 Jun 2021 17:19:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0188.hostedemail.com [216.40.44.188]) by kanga.kvack.org (Postfix) with ESMTP id C38AD6B006C for ; Mon, 14 Jun 2021 17:19:08 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 5E7028249980 for ; Mon, 14 Jun 2021 21:19:08 +0000 (UTC) X-FDA: 78253594776.14.82138BA Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) by imf15.hostedemail.com (Postfix) with ESMTP id 165E9A000247 for ; Mon, 14 Jun 2021 21:19:03 +0000 (UTC) Received: by mail-qk1-f181.google.com with SMTP id d196so34787588qkg.12 for ; Mon, 14 Jun 2021 14:19:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kPFT6nLLi1vvs4YFnK7DHOeGhzIW1Fs6DFQ1T0gCrck=; b=biiUnj1ExqttolBbEAb89QL8bsuWSOP8ozPOvpGyIPVXaX48+dqGxyTo+1pSUVs7xJ DOM157n2vskD+MQ7M6Wa2ZyYhIffBRELYKQfSKi6vCy6qJb5yq2/FsmsOx3G9MErNhE5 AckuooFjPNHwzfRp7zu4otoudRs+NTd3qiCWoDG9CwIpCJxBaNR4gt/3xYyuQVyhD6OG 1UVooRbjWx3DLZnqMCgS4WVnS93O2FIHISxYKfYVa51c5PITxwNolcDZfLaMdSaftBNp RqHBG2wZ8AvQf0JWzVViLZjJbtEaow1MSGLmMKdErHotkPeWlY2SbSgzZPJdDRltjrUm Z4ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kPFT6nLLi1vvs4YFnK7DHOeGhzIW1Fs6DFQ1T0gCrck=; b=XEGKsuf/pzHkMwcerovcYlkxFC7+2mR69w6RrCGBhSZF32f2sOsWlw4IS1Lue150Ge HbL7fwLvF4AIDGuDyGHbuAss/KbNIPQWP5GEbW2lYKxuPtegNcP61HLy2uoFUHmM8cjZ xkQqDwh82YrHdGF4QhKRrDQ+z1KooLidzRe7SB97TUf/tkcdE6/qjLR+f8pMhzTtXjAE 7T5cpBiNe09rcoiIq+wUyUVv8otYSqVT5l8WlaMWyQt+LoEt3jzdBrcvoVWcg3UkWKcz +ncC1osDybSsud5AVwMEUnLSnx1agEW+6YwdI/YIqumfypfxjAbSxqYJTFsec6r2vQi0 fNtw== X-Gm-Message-State: AOAM532EJ6fO2kr8VfrSnkTlnDP8NslkS2lbsZXM+43Kq/0ZNeZ+ysDs pb/TcpWzQIr9O0/qHovEUv7SpQ== X-Google-Smtp-Source: ABdhPJzvbqbfUECNW/9wGSUb5hxtP8w89hrKHvoC2k0yCleVRDRQ6BXu2QO6aCEMxPYVsmeHcsi6pg== X-Received: by 2002:a37:814:: with SMTP id 20mr18822511qki.243.1623705547189; Mon, 14 Jun 2021 14:19:07 -0700 (PDT) Received: from localhost (70.44.39.90.res-cmts.bus.ptd.net. [70.44.39.90]) by smtp.gmail.com with ESMTPSA id e4sm10146101qtw.62.2021.06.14.14.19.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Jun 2021 14:19:06 -0700 (PDT) From: Johannes Weiner To: Andrew Morton Cc: Roman Gushchin , Tejun Heo , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 2/4] fs: drop_caches: fix skipping over shadow cache inodes Date: Mon, 14 Jun 2021 17:19:02 -0400 Message-Id: <20210614211904.14420-2-hannes@cmpxchg.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210614211904.14420-1-hannes@cmpxchg.org> References: <20210614211904.14420-1-hannes@cmpxchg.org> MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 165E9A000247 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=biiUnj1E; spf=pass (imf15.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.181 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org X-Stat-Signature: 9otioyjo88ci1ky53rufw8sxrsygu9zb X-HE-Tag: 1623705543-456256 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: When drop_caches truncates the page cache in an inode it also includes any shadow entries for evicted pages. However, there is a preliminary check on whether the inode has pages: if it has *only* shadow entries, it will skip running truncation on the inode and leave it behind. Fix the check to mapping_empty(), such that it runs truncation on any inode that has cache entries at all. Reported-by: Roman Gushchin Signed-off-by: Johannes Weiner --- fs/drop_caches.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/drop_caches.c b/fs/drop_caches.c index f00fcc4a4f72..e619c31b6bd9 100644 --- a/fs/drop_caches.c +++ b/fs/drop_caches.c @@ -3,6 +3,7 @@ * Implement the manual drop-all-pagecache function */ =20 +#include #include #include #include @@ -27,7 +28,7 @@ static void drop_pagecache_sb(struct super_block *sb, v= oid *unused) * we need to reschedule to avoid softlockups. */ if ((inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) || - (inode->i_mapping->nrpages =3D=3D 0 && !need_resched())) { + (mapping_empty(inode->i_mapping) && !need_resched())) { spin_unlock(&inode->i_lock); continue; } --=20 2.32.0