svn commit: r291867 - stable/10/sys/fs/nfsclient
Rick Macklem
rmacklem at FreeBSD.org
Sat Dec 5 21:28:55 UTC 2015
Author: rmacklem
Date: Sat Dec 5 21:28:54 2015
New Revision: 291867
URL: https://svnweb.freebsd.org/changeset/base/291867
Log:
MFC: r291117
Revert r283330 since it broke directory caching in the client.
At this time I cannot see a way to fix directory caching when it
has partial blocks in the buffer cache, due to the fact that the
syscall's uio_offset won't stay the same as the lblkno * NFS_DIRBLKSIZ
offset.
Modified:
stable/10/sys/fs/nfsclient/nfs_clrpcops.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- stable/10/sys/fs/nfsclient/nfs_clrpcops.c Sat Dec 5 20:25:15 2015 (r291866)
+++ stable/10/sys/fs/nfsclient/nfs_clrpcops.c Sat Dec 5 21:28:54 2015 (r291867)
@@ -3087,6 +3087,25 @@ nfsrpc_readdir(vnode_t vp, struct uio *u
*eofp = eof;
}
+ /*
+ * Add extra empty records to any remaining DIRBLKSIZ chunks.
+ */
+ while (uio_uio_resid(uiop) > 0 && ((size_t)(uio_uio_resid(uiop))) != tresid) {
+ dp = (struct dirent *) CAST_DOWN(caddr_t, uio_iov_base(uiop));
+ dp->d_type = DT_UNKNOWN;
+ dp->d_fileno = 0;
+ dp->d_namlen = 0;
+ dp->d_name[0] = '\0';
+ tl = (u_int32_t *)&dp->d_name[4];
+ *tl++ = cookie.lval[0];
+ *tl = cookie.lval[1];
+ dp->d_reclen = DIRBLKSIZ;
+ uio_iov_base_add(uiop, DIRBLKSIZ);
+ uio_iov_len_add(uiop, -(DIRBLKSIZ));
+ uio_uio_resid_add(uiop, -(DIRBLKSIZ));
+ uiop->uio_offset += DIRBLKSIZ;
+ }
+
nfsmout:
if (nd->nd_mrep != NULL)
mbuf_freem(nd->nd_mrep);
@@ -3561,6 +3580,25 @@ nfsrpc_readdirplus(vnode_t vp, struct ui
*eofp = eof;
}
+ /*
+ * Add extra empty records to any remaining DIRBLKSIZ chunks.
+ */
+ while (uio_uio_resid(uiop) > 0 && uio_uio_resid(uiop) != tresid) {
+ dp = (struct dirent *)uio_iov_base(uiop);
+ dp->d_type = DT_UNKNOWN;
+ dp->d_fileno = 0;
+ dp->d_namlen = 0;
+ dp->d_name[0] = '\0';
+ tl = (u_int32_t *)&dp->d_name[4];
+ *tl++ = cookie.lval[0];
+ *tl = cookie.lval[1];
+ dp->d_reclen = DIRBLKSIZ;
+ uio_iov_base_add(uiop, DIRBLKSIZ);
+ uio_iov_len_add(uiop, -(DIRBLKSIZ));
+ uio_uio_resid_add(uiop, -(DIRBLKSIZ));
+ uiop->uio_offset += DIRBLKSIZ;
+ }
+
nfsmout:
if (nd->nd_mrep != NULL)
mbuf_freem(nd->nd_mrep);
More information about the svn-src-stable-10
mailing list