summaryrefslogtreecommitdiffstats
path: root/sys/nfsserver/nfs_serv.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2003-03-13 07:05:22 +0000
committerjeff <jeff@FreeBSD.org>2003-03-13 07:05:22 +0000
commit49e05d204e4bab027e0593dff87e14293a5f077e (patch)
tree4b323f0ea455e4b6eaea4695b0ce5d8607d23d83 /sys/nfsserver/nfs_serv.c
parent4b8b33db8ab3d11223c1226ea62c38a4549967b1 (diff)
downloadFreeBSD-src-49e05d204e4bab027e0593dff87e14293a5f077e.zip
FreeBSD-src-49e05d204e4bab027e0593dff87e14293a5f077e.tar.gz
- Lock bufs before inspecting their flags.
Diffstat (limited to 'sys/nfsserver/nfs_serv.c')
-rw-r--r--sys/nfsserver/nfs_serv.c15
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;
OpenPOWER on IntegriCloud