Add support for the eofflag to nfs_readdir() in the new NFS

client so that it works under a unionfs mount.

Submitted by:	Jared Yanovich (slovichon@gmail.com)
Reviewed by:	kib
MFC after:	2 weeks
This commit is contained in:
rmacklem 2013-05-12 21:48:08 +00:00
parent a29b04fcf3
commit 4bf4286804

View File

@ -2232,6 +2232,8 @@ nfs_readdir(struct vop_readdir_args *ap)
int error = 0;
struct vattr vattr;
if (ap->a_eofflag != NULL)
*ap->a_eofflag = 0;
if (vp->v_type != VDIR)
return(EPERM);
@ -2246,6 +2248,8 @@ nfs_readdir(struct vop_readdir_args *ap)
!NFS_TIMESPEC_COMPARE(&np->n_mtime, &vattr.va_mtime)) {
mtx_unlock(&np->n_mtx);
NFSINCRGLOBAL(newnfsstats.direofcache_hits);
if (ap->a_eofflag != NULL)
*ap->a_eofflag = 1;
return (0);
} else
mtx_unlock(&np->n_mtx);
@ -2258,8 +2262,11 @@ nfs_readdir(struct vop_readdir_args *ap)
tresid = uio->uio_resid;
error = ncl_bioread(vp, uio, 0, ap->a_cred);
if (!error && uio->uio_resid == tresid)
if (!error && uio->uio_resid == tresid) {
NFSINCRGLOBAL(newnfsstats.direofcache_misses);
if (ap->a_eofflag != NULL)
*ap->a_eofflag = 1;
}
return (error);
}