aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2021-02-28 01:54:05 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2021-02-28 01:54:05 +0000
commit3fe2c68ba20fb3365ef91e0b85f88237b5369f38 (patch)
tree21c74ebf63b414f0fea46fe4537d41eea92a1352
parentb5449c92b489445635c7962875ce73b2c9211bba (diff)
downloadsrc-3fe2c68ba20fb3365ef91e0b85f88237b5369f38.tar.gz
src-3fe2c68ba20fb3365ef91e0b85f88237b5369f38.zip
nfsclient: fix panic in cache_enter_time()
Juraj Lutter (otis@) reported a panic "dvp != vp not true" in cache_enter_time() called from the NFS client's nfsrpc_readdirplus() function. This is specific to an NFSv3 mount with the "rdirplus" mount option. Unlike NFSv4, NFSv3 replies to ReaddirPlus includes entries for the current directory. This trivial patch avoids doing a cache_enter_time() call for the current directory to avoid the panic. Reported by: otis Tested by: otis Reviewed by: mjg MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28969
-rw-r--r--sys/fs/nfsclient/nfs_clrpcops.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index b4f2d5301d13..c95d4dc58e7a 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -3761,6 +3761,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep,
ndp->ni_vp = newvp;
NFSCNHASH(cnp, HASHINIT);
if (cnp->cn_namelen <= NCHNAMLEN &&
+ ndp->ni_dvp != ndp->ni_vp &&
(newvp->v_type != VDIR ||
dctime.tv_sec != 0)) {
cache_enter_time(ndp->ni_dvp,