diff options
author | dillon <dillon@FreeBSD.org> | 1998-09-26 00:12:35 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 1998-09-26 00:12:35 +0000 |
commit | 9cb29011f9bc626b6cfc8dbf54553165aa5adbf9 (patch) | |
tree | 266061515e4e6674ac961552ab2fe68bb1124190 | |
parent | 49939b416d5ce932640b6557c232a69a54761dfc (diff) | |
download | FreeBSD-src-9cb29011f9bc626b6cfc8dbf54553165aa5adbf9.zip FreeBSD-src-9cb29011f9bc626b6cfc8dbf54553165aa5adbf9.tar.gz |
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().
-rw-r--r-- | sys/kern/vfs_bio.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c index a6a525a..09e3afb 100644 --- a/sys/kern/vfs_bio.c +++ b/sys/kern/vfs_bio.c @@ -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 $ */ /* @@ -595,6 +595,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, * but the VM object is kept around. The B_NOCACHE flag is used to |