diff options
author | kib <kib@FreeBSD.org> | 2010-10-19 08:55:31 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2010-10-19 08:55:31 +0000 |
commit | c4752b17171377483ae74146e0cac8e46081fd8d (patch) | |
tree | cf312d5e88d48fd3fe9833abce81307f59d8f930 /sys | |
parent | 4cbec41fe48ec04d799dae677c7c44d5a703e182 (diff) | |
download | FreeBSD-src-c4752b17171377483ae74146e0cac8e46081fd8d.zip FreeBSD-src-c4752b17171377483ae74146e0cac8e46081fd8d.tar.gz |
When readdirplus() is handled on the exported filesystem that does
not support VFS_VGET, like msdosfs, do not call VOP_LOOKUP() for
dotdot on the root directory. Our filesystems expect that VFS handles
dotdot lookups on root on its own.
Reported and tested by: kevlo
MFC after: 2 weeks
Diffstat (limited to 'sys')
-rw-r--r-- | sys/nfsserver/nfs_serv.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c index 833bfc7..4a3876f 100644 --- a/sys/nfsserver/nfs_serv.c +++ b/sys/nfsserver/nfs_serv.c @@ -3036,7 +3036,7 @@ nfsrv_readdirplus(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct iovec iv; struct vattr va, at, *vap = &va; struct nfs_fattr *fp; - int len, nlen, rem, xfer, tsiz, i, error = 0, getret = 1; + int len, nlen, rem, xfer, tsiz, i, error = 0, error1, getret = 1; int siz, cnt, fullsiz, eofflag, rdonly, dirlen, ncookies; u_quad_t off, toff, verf; u_long *cookies = NULL, *cookiep; /* needs to be int64_t or off_t */ @@ -3240,24 +3240,25 @@ again: } if (!VOP_ISLOCKED(vp)) vn_lock(vp, LK_SHARED | LK_RETRY); - if (VOP_LOOKUP(vp, &nvp, &cn) != 0) + if ((vp->v_vflag & VV_ROOT) != 0 && + (cn.cn_flags & ISDOTDOT) != 0) { + vref(vp); + nvp = vp; + } else if (VOP_LOOKUP(vp, &nvp, &cn) != 0) goto invalid; } bzero((caddr_t)nfhp, NFSX_V3FH); nfhp->fh_fsid = nvp->v_mount->mnt_stat.f_fsid; - if (VOP_VPTOFH(nvp, &nfhp->fh_fid)) { - vput(nvp); - nvp = NULL; - goto invalid; - } - if (VOP_GETATTR(nvp, vap, cred)) { + if ((error1 = VOP_VPTOFH(nvp, &nfhp->fh_fid)) == 0) + error1 = VOP_GETATTR(nvp, vap, cred); + if (vp == nvp) + vunref(nvp); + else vput(nvp); - nvp = NULL; - goto invalid; - } - vput(nvp); nvp = NULL; + if (error1 != 0) + goto invalid; /* * If either the dircount or maxcount will be |