summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2014-10-22 20:47:11 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2014-10-22 20:47:11 +0000
commit88cc4e92dac28d9499d243f4512e63aa16e24d3b (patch)
tree05d1f972c5340cc87d0b257d19fd2a8b6e284a60
parent53f49a7bd81ea6fd814e11aa6e97939da2ed93bd (diff)
Notes
-rw-r--r--sys/fs/nfsclient/nfs_clvfsops.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c
index 49047f69a612..5e89f0c18f75 100644
--- a/sys/fs/nfsclient/nfs_clvfsops.c
+++ b/sys/fs/nfsclient/nfs_clvfsops.c
@@ -552,7 +552,7 @@ static void
nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp,
const char *hostname, struct ucred *cred, struct thread *td)
{
- int s;
+ int i, s;
int adjsock;
char *p;
@@ -621,18 +621,36 @@ nfs_decode_args(struct mount *mp, struct nfsmount *nmp, struct nfs_args *argp,
if ((argp->flags & NFSMNT_WSIZE) && argp->wsize > 0) {
nmp->nm_wsize = argp->wsize;
- /* Round down to multiple of blocksize */
- nmp->nm_wsize &= ~(NFS_FABLKSIZE - 1);
- if (nmp->nm_wsize <= 0)
- nmp->nm_wsize = NFS_FABLKSIZE;
+ /*
+ * Clip at the power of 2 below the size. There is an
+ * issue (not isolated) that causes intermittent page
+ * faults if this is not done.
+ */
+ i = NFS_FABLKSIZE;
+ for (;;) {
+ if (i * 2 > nmp->nm_wsize) {
+ nmp->nm_wsize = i;
+ break;
+ }
+ i *= 2;
+ }
}
if ((argp->flags & NFSMNT_RSIZE) && argp->rsize > 0) {
nmp->nm_rsize = argp->rsize;
- /* Round down to multiple of blocksize */
- nmp->nm_rsize &= ~(NFS_FABLKSIZE - 1);
- if (nmp->nm_rsize <= 0)
- nmp->nm_rsize = NFS_FABLKSIZE;
+ /*
+ * Clip at the power of 2 below the size. There is an
+ * issue (not isolated) that causes intermittent page
+ * faults if this is not done.
+ */
+ i = NFS_FABLKSIZE;
+ for (;;) {
+ if (i * 2 > nmp->nm_rsize) {
+ nmp->nm_rsize = i;
+ break;
+ }
+ i *= 2;
+ }
}
if ((argp->flags & NFSMNT_READDIRSIZE) && argp->readdirsize > 0) {