1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-18 02:19:39 +00:00

nfscl: Purge name cache when readdir_plus is done

The author reported that this patch was needed to avoid
crashes on a fairly busy RISC-V system.  The author did not
provide details w.r.t. the crashes.  Although I
have not seen any such crash, the patch looks reasonable
and I have not found any regressions when testing it.

Since "rdirplus" is not a default option, the patch is
only needed if you are doing NFS mounts with the "rdirplus"
mount option and seeing crashes related to the name cache.

MFC after:	1 week
This commit is contained in:
Zaphrod Beeblebrox 2024-04-11 13:27:27 -07:00 committed by Rick Macklem
parent b724c8292d
commit d00c64bb23

View File

@ -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.
*/