uio_resid isn't updated by VOP_READDIR for nfs filesystems. Use

the uio_offset adjustment instead to calculate a correct *len.

Without this change, we run off the end of the directory data
we're reading and panic horribly for nfs filesystems.

MFC after:	1 week
This commit is contained in:
Brian Somers 2010-08-23 05:33:31 +00:00
parent f0e82e0b01
commit 90db41b62b

View File

@ -281,10 +281,9 @@ get_next_dirent(struct vnode *vp, struct dirent **dpp, char *dirbuf,
if (error)
return (error);
*off = uio.uio_offset;
*cpos = dirbuf;
*len = (dirbuflen - uio.uio_resid);
*len = uio.uio_offset - *off;
*off = uio.uio_offset;
}
dp = (struct dirent *)(*cpos);