NFS: Don't revalidate the directory permissions on a lookup failure
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 8 Mar 2021 19:42:51 +0000 (14:42 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Mar 2021 16:06:33 +0000 (17:06 +0100)
commitdd756d05bee58077ea0239861022ca83e7d8d23d
tree9d4fa4cbf7c1bc40b3aba81784075b3769374ca4
parentfaa48b23d0e39e0120e728e66ac58cb69690a609
NFS: Don't revalidate the directory permissions on a lookup failure

[ Upstream commit 82e7ca1334ab16e2e04fafded1cab9dfcdc11b40 ]

There should be no reason to expect the directory permissions to change
just because the directory contents changed or a negative lookup timed
out. So let's avoid doing a full call to nfs_mark_for_revalidate() in
that case.
Furthermore, if this is a negative dentry, and we haven't actually done
a new lookup, then we have no reason yet to believe the directory has
changed at all. So let's remove the gratuitous directory inode
invalidation altogether when called from
nfs_lookup_revalidate_negative().

Reported-by: Geert Jansen <gerardu@amazon.com>
Fixes: 5ceb9d7fdaaf ("NFS: Refactor nfs_lookup_revalidate()")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/dir.c