NFS: Don't gratuitously clear the inode cache when lookup failed

The fact that the lookup revalidation failed, does not mean that the
inode contents have changed.

Fixes: 5ceb9d7fda ("NFS: Refactor nfs_lookup_revalidate()")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Trond Myklebust 2021-03-08 14:42:52 -05:00 committed by Anna Schumaker
parent 82e7ca1334
commit 47397915ed

View File

@ -1444,18 +1444,14 @@ nfs_lookup_revalidate_done(struct inode *dir, struct dentry *dentry,
__func__, dentry); __func__, dentry);
return 1; return 1;
case 0: case 0:
if (inode && S_ISDIR(inode->i_mode)) { /*
/* Purge readdir caches. */ * We can't d_drop the root of a disconnected tree:
nfs_zap_caches(inode); * its d_hash is on the s_anon list and d_drop() would hide
/* * it from shrink_dcache_for_unmount(), leading to busy
* We can't d_drop the root of a disconnected tree: * inodes on unmount and further oopses.
* its d_hash is on the s_anon list and d_drop() would hide */
* it from shrink_dcache_for_unmount(), leading to busy if (inode && IS_ROOT(dentry))
* inodes on unmount and further oopses. return 1;
*/
if (IS_ROOT(dentry))
return 1;
}
dfprintk(LOOKUPCACHE, "NFS: %s(%pd2) is invalid\n", dfprintk(LOOKUPCACHE, "NFS: %s(%pd2) is invalid\n",
__func__, dentry); __func__, dentry);
return 0; return 0;