summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2012-12-10 22:34:54 +0000
committerBob Beck <beck@cvs.openbsd.org>2012-12-10 22:34:54 +0000
commit812203ba2f32d8077ffec16198a5d6a4ae88cefe (patch)
treef81962389b88e78805c95b8e8b4eaf83f28c6f88
parent81b7065f9af9992550635c662e941f11db41009c (diff)
Ensure NFS will only consume up to 1/4 of the available buffer
mapping kva when busying up buffers in an nfsiod. (this in addition to the previous check for 1/4 of the total buffer space) This makes sparc installs work over nfsv2. ok deraadt@
-rw-r--r--sys/nfs/nfs_syscalls.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c
index 12d70634aa8..ce4549057c9 100644
--- a/sys/nfs/nfs_syscalls.c
+++ b/sys/nfs/nfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_syscalls.c,v 1.93 2012/04/22 05:43:14 guenther Exp $ */
+/* $OpenBSD: nfs_syscalls.c,v 1.94 2012/12/10 22:34:53 beck Exp $ */
/* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */
/*
@@ -570,7 +570,8 @@ nfssvc_iod(void *arg)
struct vnode *vp;
int error = 0, s, bufcount;
- bufcount = 256; /* XXX: Big enough? sysctl, constant ? */
+ bufcount = MIN(256, bcstats.kvaslots / 8);
+ bufcount = MIN(bufcount, bcstats.numbufs / 8);
/* Assign my position or return error if too many already running. */
myiod = -1;
@@ -587,8 +588,12 @@ nfssvc_iod(void *arg)
nfs_numasync++;
/* Upper limit on how many bufs we'll queue up for this iod. */
+ if (nfs_bufqmax > bcstats.kvaslots / 4) {
+ nfs_bufqmax = bcstats.kvaslots / 4;
+ bufcount = 0;
+ }
if (nfs_bufqmax > bcstats.numbufs / 4) {
- nfs_bufqmax = bcstats.numbufs / 4; /* limit to 1/4 of bufs */
+ nfs_bufqmax = bcstats.numbufs / 4;
bufcount = 0;
}