Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3527433pxf; Mon, 15 Mar 2021 11:32:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyq1wzt+IUqXBGVmqomaVML45jVBtGmjcYIV4y1ssyfqkMYmvaIDB2EMDKGnCpDpCU5K7Mg X-Received: by 2002:a17:907:2d24:: with SMTP id gs36mr25279239ejc.344.1615833161314; Mon, 15 Mar 2021 11:32:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833161; cv=none; d=google.com; s=arc-20160816; b=Llt7EjXCTvYAaIdC3J39ur+xdU4uG/gRGNNQ0lvXEFIMT1LQiUlVBm4BDhILhgW2hq 5pcM9cUQSck01kHDYYILz/BdyxO2T/YwawhLjwXYv2gmT6bKdISIJUQZg3gbUa5tLywK f1oDXsP1EL0jQ/gtDaa3jJSREdu/Vv/jcGiEl9jeh0ylydVIwClgWfWrPiQrx0is684s WmbVs4XiRstREDARif4FoLFdk6eqqSBqaX/JOjX21yyR/5ZwCA2RG9xya2C8BqTXhElB cE/Q7CEwkdkbr/MBrNoAHTDQ3w2kM3C223A0sEszHdP/FVIfEI05p7GThcw3qukUjmgk ECvA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BefWDC8UR1v3lFDCYMSbFPQkK7xDMaJkREUPpEQlMqI=; b=W+bx3vN0vobdiaQ8BLHkYNmOFJWNSnaEeIb8pyqM1fLajNdq8qJvPP7aI+oSab41IQ w2Sw6mTPjs5kaBxfPnmUQnD8sIQWpi6vh+yWZW1lM2a2lq4PfGmLjcSrbz8QPkgZC/oB 34ld5H+9fqQ+KR9/oPN6xMq/Zwpe0fBE1rOyjR8B5YsftcSXa1y4OL+mBLkfPtpW1ivo jKxJECMdX98HTD3C4bmXHTrf4KtWcRUvQERLhgdgg2xlywjGhW4iT/RhwJkOwbkFRjsS 4DwJod55ieCYHjH8p0ToBnRApTWzAZ1LCt7uD+f5lx8SHHcoFZ+enlC+eiw9IHY6Uu/o X9JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="kG/wllXi"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pw11si11438048ejb.2.2021.03.15.11.32.19; Mon, 15 Mar 2021 11:32:41 -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=@linuxfoundation.org header.s=korg header.b="kG/wllXi"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238415AbhCOOmg (ORCPT + 99 others); Mon, 15 Mar 2021 10:42:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:49564 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234285AbhCOODK (ORCPT ); Mon, 15 Mar 2021 10:03:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A811E64EFD; Mon, 15 Mar 2021 14:03:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816989; bh=ERz6ssP8kJ488LaIEYLEXzLP4bSgglreztNgSBLk5xE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kG/wllXiSZ43bCP4klYoK4vAyZgrSTNPVzSyie+x/gkrkttYRLzRKsNhgaV267pfe CUDfsOF+S9EXuSrVJvYxEI8IaKgRLtNYL2dUr24/avsS91zdnjCLmfW5br6e8HUGWA EbmWRohaZqS/LEJ1Z219JOtrlrgwdaDe2RbjATQE= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Anna Schumaker , Sasha Levin Subject: [PATCH 5.11 247/306] NFS: Dont gratuitously clear the inode cache when lookup failed Date: Mon, 15 Mar 2021 14:55:10 +0100 Message-Id: <20210315135515.996670172@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Trond Myklebust [ Upstream commit 47397915ede0192235474b145ebcd81b37b03624 ] The fact that the lookup revalidation failed, does not mean that the inode contents have changed. Fixes: 5ceb9d7fdaaf ("NFS: Refactor nfs_lookup_revalidate()") Signed-off-by: Trond Myklebust Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- fs/nfs/dir.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 7bcc6fcf1096..4db3018776f6 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -1444,18 +1444,14 @@ nfs_lookup_revalidate_done(struct inode *dir, struct dentry *dentry, __func__, dentry); return 1; case 0: - if (inode && S_ISDIR(inode->i_mode)) { - /* Purge readdir caches. */ - nfs_zap_caches(inode); - /* - * We can't d_drop the root of a disconnected tree: - * its d_hash is on the s_anon list and d_drop() would hide - * it from shrink_dcache_for_unmount(), leading to busy - * inodes on unmount and further oopses. - */ - if (IS_ROOT(dentry)) - return 1; - } + /* + * We can't d_drop the root of a disconnected tree: + * its d_hash is on the s_anon list and d_drop() would hide + * it from shrink_dcache_for_unmount(), leading to busy + * inodes on unmount and further oopses. + */ + if (inode && IS_ROOT(dentry)) + return 1; dfprintk(LOOKUPCACHE, "NFS: %s(%pd2) is invalid\n", __func__, dentry); return 0; -- 2.30.1