summaryrefslogtreecommitdiffstats
path: root/sys/nfsserver
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2003-02-25 03:37:48 +0000
committerjeff <jeff@FreeBSD.org>2003-02-25 03:37:48 +0000
commit9e4c9a6ce908881b1e6f83cbb906a9fce08dd3ab (patch)
treedf5eb5e550ba49b92f45eadaca861cb18128ad5d /sys/nfsserver
parent541937cf7373ff6a61c871266ea041503bb02233 (diff)
downloadFreeBSD-src-9e4c9a6ce908881b1e6f83cbb906a9fce08dd3ab.zip
FreeBSD-src-9e4c9a6ce908881b1e6f83cbb906a9fce08dd3ab.tar.gz
- Add an interlock argument to BUF_LOCK and BUF_TIMELOCK.
- Remove the buftimelock mutex and acquire the buf's interlock to protect these fields instead. - Hold the vnode interlock while locking bufs on the clean/dirty queues. This reduces some cases from one BUF_LOCK with a LK_NOWAIT and another BUF_LOCK with a LK_TIMEFAIL to a single lock. Reviewed by: arch, mckusick
Diffstat (limited to 'sys/nfsserver')
-rw-r--r--sys/nfsserver/nfs_serv.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c
index 1d953cd..e35b4dc 100644
--- a/sys/nfsserver/nfs_serv.c
+++ b/sys/nfsserver/nfs_serv.c
@@ -3687,6 +3687,7 @@ nfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
}
s = splbio();
+ VI_LOCK(vp);
while (cnt > 0) {
struct buf *bp;
@@ -3700,16 +3701,18 @@ nfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
* should not be set if B_INVAL is set there could be
* a race here since we haven't locked the buffer).
*/
- if ((bp = incore(vp, lblkno)) != NULL &&
+ if ((bp = gbincore(vp, lblkno)) != NULL &&
(bp->b_flags & (B_DELWRI|B_INVAL)) == B_DELWRI) {
- if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT)) {
- BUF_LOCK(bp, LK_EXCLUSIVE | LK_SLEEPFAIL);
+ if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_SLEEPFAIL |
+ LK_INTERLOCK, VI_MTX(vp)) == ENOLCK) {
+ VI_LOCK(vp);
continue; /* retry */
}
bremfree(bp);
bp->b_flags &= ~B_ASYNC;
BUF_WRITE(bp);
++nfs_commit_miss;
+ VI_LOCK(vp);
}
++nfs_commit_blks;
if (cnt < iosize)
@@ -3717,6 +3720,7 @@ nfsrv_commit(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp,
cnt -= iosize;
++lblkno;
}
+ VI_UNLOCK(vp);
splx(s);
}
OpenPOWER on IntegriCloud