Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3524417pxf; Mon, 15 Mar 2021 11:28:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwpgCdMa6BvqWMiY/6t+756cFN1LEBn9m09bAkX+uCV9HrkuwRqs7sxsy4GGmiKVKZoRyBR X-Received: by 2002:a05:6402:c1:: with SMTP id i1mr31136600edu.315.1615832920231; Mon, 15 Mar 2021 11:28:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832920; cv=none; d=google.com; s=arc-20160816; b=AeV3QxqfjTSWEjSRFFYX5SioFkdQB2RQqwzvTgNtfeLFWz88CieLPvGaAEm0210aP1 vW6oNedXIQJblGrYK+mq/K5Z1+fV4WX2PfjxTRS+cmZua1TLl3WvTKHomGHi2Mw+99Yj Qr1q5Cuyp3UOzqLOKoBuvd3XFf56Qahrv6cmgnmduC+rsqHjThDJHtOwmKPJBmQrtSEH cnnmbPf3YiqTy9LD1i05D4DlcThxUrmu5jGIyTzZV7n15soOiZPVeCD/6npjDP42D1Yz p3FPNXF7T9rx6AxDyv82NCtnOPIFKu07GySbTB8kqPeNJ+tM1GwsGvKobGuMi8NG7uDz EgfA== 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=+ilXSYDQ0pGu/sTKMI/m9NR9x+/Ilp6iGyF2DIoUVqA=; b=yl1dzWNWt6td5YyQaW+Kb5PAGzaq6Dd7NRb9773XyFfRO6moWdWwX3HAmbC48CFfLg LlfivxnFenZshh/eZT9NZb9Hyc2sNTQq4cIOZB3q0PB5z9AyxR2LryKUrfRDTO6NVOC1 O/8Z1WiVN2HE1UUAHnEEjW3RhUApV6V0My1oztj6df2ZBi/vSp2fdDBuV65Ci5Kgel0T e7mnpyLdz3LN3hF56ajkVOSvR6J6hN2JAFBw5HDOZPeJtg4RKG8HUVph0VcN7U0pUK9l cdZUWt08oxoR+ucXON4E+cU4jGqV+XZ6qDE4Z6jlCnQS7r0t9kX/lc707THNX90gS4zA uoRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xdcKhRKi; 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 x10si11639228ejs.610.2021.03.15.11.28.10; Mon, 15 Mar 2021 11:28:40 -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=xdcKhRKi; 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 S238867AbhCOOcC (ORCPT + 99 others); Mon, 15 Mar 2021 10:32:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:38284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233215AbhCOOBL (ORCPT ); Mon, 15 Mar 2021 10:01:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BB6A064F1E; Mon, 15 Mar 2021 14:00:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816841; bh=2Qvw5oxgi1UZ0Go013q4G6uaRYto2WTdKaVUvB/OSeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xdcKhRKiaW3diFXf9UBAFcXpMva+m7o3pInB0n16V0LyyTisnFxgg2Kz/5dtadwVj ZcAsJR3rYi6NJhGJaQXYhkL451K9N+e+miJSq7kLVs8HS5TosttmLgE1kexO7lFUT1 g/zBNp21d/Fm5R37bXpxfhwElnZLVzHmixVEzrgQ= 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.4 147/168] NFS: Dont gratuitously clear the inode cache when lookup failed Date: Mon, 15 Mar 2021 14:56:19 +0100 Message-Id: <20210315135555.168479516@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@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 59092d2780a3..e7c0790308fe 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -1116,18 +1116,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