svn commit: r273481 - head/sys/fs/nfsclient
Rick Macklem
rmacklem at FreeBSD.org
Wed Oct 22 20:47:12 UTC 2014
Author: rmacklem
Date: Wed Oct 22 20:47:11 2014
New Revision: 273481
URL: https://svnweb.freebsd.org/changeset/base/273481
Log:
Clip the settings for the NFS rsize, wsize mount options
to a power of 2. For non-power of 2 settings, intermittent
page faults have been reported. Although the bug that causes
these page faults/crashes has not been identified, it does
not appear to occur when rsize, wsize is a power of 2.
Reported by: tcberner at gmail.com
MFC after: 2 weeks
Modified:
head/sys/fs/nfsclient/nfs_clvfsops.c
Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvfsops.c Wed Oct 22 18:55:44 2014 (r273480)
+++ head/sys/fs/nfsclient/nfs_clvfsops.c Wed Oct 22 20:47:11 2014 (r273481)
@@ -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
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) {
More information about the svn-src-head
mailing list