diff options
author | jeff <jeff@FreeBSD.org> | 2003-03-13 07:04:11 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2003-03-13 07:04:11 +0000 |
commit | 4b8b33db8ab3d11223c1226ea62c38a4549967b1 (patch) | |
tree | 5c8950e330aa692f14fbaf472ca9949158bf99b2 | |
parent | dc2fc01c024e4580e7f2bca3873518c3c480d23c (diff) | |
download | FreeBSD-src-4b8b33db8ab3d11223c1226ea62c38a4549967b1.zip FreeBSD-src-4b8b33db8ab3d11223c1226ea62c38a4549967b1.tar.gz |
- Lock the buf before inspecting its contents.
-rw-r--r-- | sys/nfsclient/nfs_vnops.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index 2a137b7..253f0c7 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -2658,18 +2658,16 @@ again: for (bp = TAILQ_FIRST(&vp->v_dirtyblkhd); bp; bp = nbp) { if (bvecpos >= bvecsize) break; - if ((bp->b_flags & (B_DELWRI | B_NEEDCOMMIT)) != - (B_DELWRI | B_NEEDCOMMIT)) { + if (BUF_LOCK(bp, LK_EXCLUSIVE | LK_NOWAIT, NULL)) { nbp = TAILQ_NEXT(bp, b_vnbufs); continue; } - if (BUF_LOCK(bp, - LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK, - VI_MTX(vp))) { - VI_LOCK(vp); + if ((bp->b_flags & (B_DELWRI | B_NEEDCOMMIT)) != + (B_DELWRI | B_NEEDCOMMIT)) { nbp = TAILQ_NEXT(bp, b_vnbufs); continue; } + VI_UNLOCK(vp); bremfree(bp); /* * Work out if all buffers are using the same cred |