From patchwork Wed Mar 3 04:28:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trond Myklebust X-Patchwork-Id: 12113281 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=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 5BF57C28D13 for ; Wed, 3 Mar 2021 11:03:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2F82664EE9 for ; Wed, 3 Mar 2021 11:03:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345001AbhCCK6Q (ORCPT ); Wed, 3 Mar 2021 05:58:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:56560 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444005AbhCCE3U (ORCPT ); Tue, 2 Mar 2021 23:29:20 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8878564EC0; Wed, 3 Mar 2021 04:28:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614745718; bh=0stP7r4ZoXAMNXgPuZItc5apuDtDXhbakYQ5nIw0v10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gk/JY9pCIpF+oc6tEhkAIL/Jao/GnvTE7m+JmxXowom+YLx70/9J4EV/x+xx8sZ0p WuBXsUCx8VVQG15ut3DAWUlDgyVd11qvnfDsmb3jcXY29YI5SSOxjjRlqC3vizW3co tgUaSCaLFZErxa1lgmw4bzOkUD4FQE+1a6V4E5zpxT0USNPPLA/h0LrXnTu/1EXY5I DqpOMN1+0qbRKDaebSjiAG4jzvNFap/jAF7CH5CNRSYqPWNgUCRYMh5VtdPkFXxtbD 7Ge4BN37sHu/pQph5p3jRbBv7NAyjZR29/UM/ZDfGhA11Ghg22O8Me6D/nAHKleuSn UBJ6Vnxxg/BwA== From: trondmy@kernel.org To: Geert Jansen Cc: linux-nfs@vger.kernel.org Subject: [PATCH 2/2] NFS: Don't gratuitously clear the inode cache when lookup failed Date: Tue, 2 Mar 2021 23:28:36 -0500 Message-Id: <20210303042836.200413-2-trondmy@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210303042836.200413-1-trondmy@kernel.org> References: <20210303042836.200413-1-trondmy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Trond Myklebust 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 --- 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 6350873cb8bd..deb6ad0622ed 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;