summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2010-04-12 16:37:39 +0000
committerBob Beck <beck@cvs.openbsd.org>2010-04-12 16:37:39 +0000
commitb21be0a881207d66328a4b1fb9e42175809eae01 (patch)
treeb9671664237cf20154efede68a325609cf51ebde /sys
parentb468cb40bfbf32b9fe0a861f825aafe2ae4a74cd (diff)
Don't jump the queue if we have to wait on the client side because
the nfs_bufq is full - instead tsleep waiting for one of our nfsiod's to free up space for us in the queue so we can enqueue on the end. ok blambert@, tedu@, oga@
Diffstat (limited to 'sys')
-rw-r--r--sys/nfs/nfs_bio.c13
-rw-r--r--sys/nfs/nfs_syscalls.c4
-rw-r--r--sys/nfs/nfs_var.h4
-rw-r--r--sys/nfs/nfs_vnops.c4
4 files changed, 15 insertions, 10 deletions
diff --git a/sys/nfs/nfs_bio.c b/sys/nfs/nfs_bio.c
index c16791483d6..accd806410e 100644
--- a/sys/nfs/nfs_bio.c
+++ b/sys/nfs/nfs_bio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_bio.c,v 1.70 2010/04/09 22:42:10 oga Exp $ */
+/* $OpenBSD: nfs_bio.c,v 1.71 2010/04/12 16:37:38 beck Exp $ */
/* $NetBSD: nfs_bio.c,v 1.25.4.2 1996/07/08 20:47:04 jtc Exp $ */
/*
@@ -156,7 +156,7 @@ nfs_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred)
return (EINTR);
if ((rabp->b_flags & (B_DELWRI | B_DONE)) == 0) {
rabp->b_flags |= (B_READ | B_ASYNC);
- if (nfs_asyncio(rabp)) {
+ if (nfs_asyncio(rabp, 1)) {
rabp->b_flags |= B_INVAL;
brelse(rabp);
}
@@ -492,13 +492,16 @@ nfs_vinvalbuf(struct vnode *vp, int flags, struct ucred *cred, struct proc *p)
* are all hung on a dead server.
*/
int
-nfs_asyncio(struct buf *bp)
+nfs_asyncio(struct buf *bp, int readahead)
{
if (nfs_numasync == 0)
goto out;
- if (nfs_bufqlen > nfs_bufqmax)
- goto out; /* too many bufs in use, force sync */
+ while (nfs_bufqlen > nfs_bufqmax)
+ if (readahead)
+ goto out;
+ else
+ tsleep(&nfs_bufqlen, PRIBIO, "nfs_bufq", 0);
if ((bp->b_flags & B_READ) == 0) {
bp->b_flags |= B_WRITEINPROG;
diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c
index 0b9c45ab4d7..77bfff39817 100644
--- a/sys/nfs/nfs_syscalls.c
+++ b/sys/nfs/nfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_syscalls.c,v 1.88 2009/10/19 22:24:18 jsg Exp $ */
+/* $OpenBSD: nfs_syscalls.c,v 1.89 2010/04/12 16:37:38 beck Exp $ */
/* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */
/*
@@ -591,6 +591,7 @@ nfssvc_iod(void *arg)
}
nfs_bufqmax += bufcount;
+ wakeup(&nfs_bufqlen); /* wake up anyone waiting for room to enqueue IO */
/* Just loop around doin our stuff until SIGKILL. */
for (;;) {
@@ -635,6 +636,7 @@ nfssvc_iod(void *arg)
(void) nfs_doio(bp, NULL);
} while ((bp = nbp) != NULL);
+ wakeup_one(&nfs_bufqlen); /* wake up anyone waiting for room to enqueue IO */
}
if (error) {
nfs_asyncdaemon[myiod] = NULL;
diff --git a/sys/nfs/nfs_var.h b/sys/nfs/nfs_var.h
index 56fb97a615d..9ddc8398c20 100644
--- a/sys/nfs/nfs_var.h
+++ b/sys/nfs/nfs_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_var.h,v 1.58 2009/09/02 18:20:54 thib Exp $ */
+/* $OpenBSD: nfs_var.h,v 1.59 2010/04/12 16:37:38 beck Exp $ */
/* $NetBSD: nfs_var.h,v 1.3 1996/02/18 11:53:54 fvdl Exp $ */
/*
@@ -49,7 +49,7 @@ int nfs_bioread(struct vnode *, struct uio *, int, struct ucred *);
int nfs_write(void *);
struct buf *nfs_getcacheblk(struct vnode *, daddr64_t, int, struct proc *);
int nfs_vinvalbuf(struct vnode *, int, struct ucred *, struct proc *);
-int nfs_asyncio(struct buf *);
+int nfs_asyncio(struct buf *, int readahead);
int nfs_doio(struct buf *, struct proc *);
/* nfs_boot.c */
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c
index 5f0fbf3d0b6..20e38f543bb 100644
--- a/sys/nfs/nfs_vnops.c
+++ b/sys/nfs/nfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vnops.c,v 1.128 2010/03/29 23:33:39 krw Exp $ */
+/* $OpenBSD: nfs_vnops.c,v 1.129 2010/04/12 16:37:38 beck Exp $ */
/* $NetBSD: nfs_vnops.c,v 1.62.4.1 1996/07/08 20:26:52 jtc Exp $ */
/*
@@ -2715,7 +2715,7 @@ nfs_strategy(void *v)
* queue the request, wake it up and wait for completion
* otherwise just do it ourselves.
*/
- if ((bp->b_flags & B_ASYNC) == 0 || nfs_asyncio(bp))
+ if ((bp->b_flags & B_ASYNC) == 0 || nfs_asyncio(bp, 0))
error = nfs_doio(bp, p);
return (error);
}