PR: kern/7418

Reviewed by:	Luoqi Chen <luoqi@watermarkgroup.com>

    Fixed problem where write()s can get lost due to buffers flagged B_DELWRI
    being improperly released in brelse().
This commit is contained in:
dillon 1998-09-26 00:12:35 +00:00
parent 49939b416d
commit 9cb29011f9

View File

@ -11,7 +11,7 @@
* 2. Absolutely no warranty of function or purpose is made by the author
* John S. Dyson.
*
* $Id: vfs_bio.c,v 1.176 1998/09/15 10:05:18 gibbs Exp $
* $Id: vfs_bio.c,v 1.177 1998/09/25 17:34:49 peter Exp $
*/
/*
@ -594,6 +594,19 @@ brelse(struct buf * bp)
}
}
/*
* We must clear B_RELBUF if B_DELWRI is set. If vfs_vmio_release()
* is called with B_DELWRI set, the underlying pages may wind up
* getting freed causing a previous write (bdwrite()) to get 'lost'
* because pages associated with a B_DELWRI bp are marked clean.
*
* We still allow the B_INVAL case to call vfs_vmio_release(), even
* if B_DELWRI is set.
*/
if (bp->b_flags & B_DELWRI)
bp->b_flags &= ~B_RELBUF;
/*
* VMIO buffer rundown. It is not very necessary to keep a VMIO buffer
* constituted, so the B_INVAL flag is used to *invalidate* the buffer,