diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 0b8c587a542..85c0ebd7a10 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -2459,6 +2459,16 @@ nfs_readdir(struct vop_readdir_args *ap) return (EINVAL); uio->uio_resid -= left; + /* + * For readdirplus, if starting to read the directory, + * purge the name cache, since it will be reloaded by + * this directory read. + * This removes potentially stale name cache entries. + */ + if (uio->uio_offset == 0 && + (VFSTONFS(vp->v_mount)->nm_flag & NFSMNT_RDIRPLUS) != 0) + cache_purge(vp); + /* * Call ncl_bioread() to do the real work. */