nfscl: Avoid KASSERT() panic in cache_enter_time()

Commit 844aa31c6d87 added cache_enter_time_flags(), specifically
so that the NFS client could specify that cache enter replace
any stale entry for the same name.  Doing so avoids a KASSERT()
panic() in cache_enter_time(), as reported by the PR.

This patch uses cache_enter_time_flags() for Readdirplus, to
avoid the panic(), since it is impossible for the NFS client
to know if another client (or a local process on the NFS server)
has replaced a file with another file of the same name.

This patch only affects NFS mounts that use the "rdirplus"
mount option.

There may be other places in the NFS client where this needs
to be done, but no panic() has been observed during testing.

PR:	257043
MFC after:	2 weeks
This commit is contained in:
Rick Macklem 2021-07-14 13:33:37 -07:00
parent d1a0eab9fb
commit 7f5508fe78

View File

@ -3762,11 +3762,11 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
ndp->ni_dvp != ndp->ni_vp &&
(newvp->v_type != VDIR ||
dctime.tv_sec != 0)) {
cache_enter_time(ndp->ni_dvp,
cache_enter_time_flags(ndp->ni_dvp,
ndp->ni_vp, cnp,
&nfsva.na_ctime,
newvp->v_type != VDIR ? NULL :
&dctime);
&dctime, VFS_CACHE_DROPOLD);
}
if (unlocknewvp)
vput(newvp);