diff options
author | jeff <jeff@FreeBSD.org> | 2003-03-13 07:05:22 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2003-03-13 07:05:22 +0000 |
commit | 49e05d204e4bab027e0593dff87e14293a5f077e (patch) | |
tree | 4b323f0ea455e4b6eaea4695b0ce5d8607d23d83 /sys/nfsserver | |
parent | 4b8b33db8ab3d11223c1226ea62c38a4549967b1 (diff) | |
download | FreeBSD-src-49e05d204e4bab027e0593dff87e14293a5f077e.zip FreeBSD-src-49e05d204e4bab027e0593dff87e14293a5f077e.tar.gz |
- Lock bufs before inspecting their flags.
Diffstat (limited to 'sys/nfsserver')
-rw-r--r-- | sys/nfsserver/nfs_serv.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c index e35b4dc..5c8554e 100644 --- a/sys/nfsserver/nfs_serv.c +++ b/sys/nfsserver/nfs_serv.c @@ -3701,17 +3701,20 @@ 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 = gbincore(vp, lblkno)) != NULL && - (bp->b_flags & (B_DELWRI|B_INVAL)) == B_DELWRI) { + if ((bp = gbincore(vp, lblkno)) != NULL) { 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; + if ((bp->b_flags & (B_DELWRI|B_INVAL)) == + B_DELWRI) { + bremfree(bp); + bp->b_flags &= ~B_ASYNC; + BUF_WRITE(bp); + ++nfs_commit_miss; + } else + BUF_UNLOCK(bp); VI_LOCK(vp); } ++nfs_commit_blks; |