Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3093608pxj; Mon, 14 Jun 2021 14:20:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQF/X1AOjAPP6kMgi7G5nXJ7Sf9llclDEPbkAkQqRTX6P9nrBUKmdvKCQx7t3Q6UAS4RJz X-Received: by 2002:aa7:dc51:: with SMTP id g17mr19420661edu.43.1623705636409; Mon, 14 Jun 2021 14:20:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623705636; cv=none; d=google.com; s=arc-20160816; b=iUZ9NGIj8r0C7ajF3uHLhhQiX7ZEBUKZ1JssDEBSPPF/s7JnMkKdSgsSs3pZipPY0C tzCwWdZ89nhKmH9RwR+xyWX8A05SYwtzrVsZWtV0P56uibCXgrTd/zxO3WUBNqkjFFxe KtFdeBwWi1edajTlDRijISPgdT9YVGKkN8VI6t13LZJUFWGmtGdcyNhZbKDcuUDx+m80 ovrIY7jmQAV8VKOw6Pqy0CcJpWxwW9wmx/XMAtICjlq3vnS2eg1iAvq61zowT7TKvNWR lbHBqJr8UOEuzHub2JFifEGejYxANVwaafBIcYqPrO1YLsPS/q8wUh96kSHViG3c8zE5 OmJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kPFT6nLLi1vvs4YFnK7DHOeGhzIW1Fs6DFQ1T0gCrck=; b=Rq8U+X+eONHsuiEpqR2vDfTUAzHoGVLAyEciofDKPM15pmfcPQ5YSgYfzVEY/fTz8F GoQkbWkLQfxUmOrnPUZfAJjrjQiWymQiwaZMKp4e/XugE9pnnWhSpYsARVormozjGfnv nxXaZBNdLCsPNyCNxPZ+KMMLUUkoBs+J93BxZCk6Wg9Oqf9eUvJxoE50yyn5V/ACS1OP epZjXH7wD0ubSSdnMkO6y/9HMImIf/pecp8RkExYB7Bi0e3/7bzo+1liQvi7m9ybiY4T HIe5oBjb/mjuGuzwhXkgbK4DTmqp/M/Gy0oFtciM6rj8wqqbhRf+PbkKd0OCu056Epi4 1ElA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=biiUnj1E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c11si12780610edt.322.2021.06.14.14.20.13; Mon, 14 Jun 2021 14:20:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=biiUnj1E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234397AbhFNVVM (ORCPT + 99 others); Mon, 14 Jun 2021 17:21:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230081AbhFNVVM (ORCPT ); Mon, 14 Jun 2021 17:21:12 -0400 Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA68BC061574 for ; Mon, 14 Jun 2021 14:19:08 -0700 (PDT) Received: by mail-qk1-x731.google.com with SMTP id f70so24723796qke.13 for ; Mon, 14 Jun 2021 14:19:08 -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=JIUfYPya8+FC0H8WBk8hk09JC/BJ9Hq7YS0IzAxaV4rilQskx6Z2+y2I+GQjvIhETW cRQaQDoeszh/fbqYGU2eLz8m9Kv8Zc5/qNi5ymncxFJUeaOzirL+2hOhorJLm1nACljn siRwTxuG25G3RRXURavkWgql7MAqQWLn62+5RqVwISnbq3hvit+jfioehy29TrhZ8Bfd ctNnsSgaKSgelKfS0N33b9nckGmstM94I3XUiQZ/dBXIC2Hu8QYTk+lFmFHLZfDS6d6u lyP7Uy08a5H2iC8y4QHUL20yPMI+uKkFqpfjUUONNY3ZZ/mDJMXQgewn2mhdvcLelN4q L01g== X-Gm-Message-State: AOAM5323P58wD2Xmkef6wn80DEsLSxlbNDMSsc4QU32DH4GY/R02vb4B gghJ0AS0BlDQ8St4F3zNUUaXuA== 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 */ +#include #include #include #include @@ -27,7 +28,7 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused) * we need to reschedule to avoid softlockups. */ if ((inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) || - (inode->i_mapping->nrpages == 0 && !need_resched())) { + (mapping_empty(inode->i_mapping) && !need_resched())) { spin_unlock(&inode->i_lock); continue; } -- 2.32.0