Re-lookup the buffer if the vnode isn't locked. The previous check for

VBLK vnodes isn't adequate since all NFS nodes aren't locked, either. The
result is a race condition that would lead to duplicate buffers at the
same block offset.

Submitted by:	John Dyson
This commit is contained in:
David Greenman 1995-07-21 04:55:45 +00:00
parent 2094ddb6f0
commit 44918dfed7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9602

View File

@ -18,7 +18,7 @@
* 5. Modifications may be freely made to this file if the above conditions
* are met.
*
* $Id: vfs_bio.c,v 1.48 1995/07/15 16:01:46 davidg Exp $
* $Id: vfs_bio.c,v 1.49 1995/07/17 06:26:07 davidg Exp $
*/
/*
@ -859,10 +859,8 @@ getblk(struct vnode * vp, daddr_t blkno, int size, int slpflag, int slptimeo)
* created while the getnewbuf routine is blocked.
* Normally the vnode is locked so this isn't a problem.
* VBLK type I/O requests, however, don't lock the vnode.
* VOP_ISLOCKED would be much better but is also much
* slower.
*/
if ((vp->v_type == VBLK) && incore(vp, blkno)) {
if (!VOP_ISLOCKED(vp) && incore(vp, blkno)) {
bp->b_flags |= B_INVAL;
brelse(bp);
goto loop;