summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_bio.c
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2009-07-19 20:25:59 +0000
committerkib <kib@FreeBSD.org>2009-07-19 20:25:59 +0000
commit9defbad772d8a70e282b11397513b9380177143a (patch)
tree3d0ec1113dd334e28b28ab00e1a608de6b9d94b8 /sys/kern/vfs_bio.c
parentec40877eda62735f117b38684a1eb92b75b172e5 (diff)
downloadFreeBSD-src-9defbad772d8a70e282b11397513b9380177143a.zip
FreeBSD-src-9defbad772d8a70e282b11397513b9380177143a.tar.gz
When buffer write is failed, it is wrong for brelse() to invalidate
portion of the page that was written. Among other problems, this page might be picked up by pagedaemon, with failed assertion in vm_pageout_flush() about validity of the page. Reported and tested by: pho Approved by: re (kensmith) MFC after: 3 weeks
Diffstat (limited to 'sys/kern/vfs_bio.c')
-rw-r--r--sys/kern/vfs_bio.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index 65e9460..df9a257 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -1330,7 +1330,8 @@ brelse(struct buf *bp)
m = bp->b_pages[i];
}
if ((bp->b_flags & B_NOCACHE) ||
- (bp->b_ioflags & BIO_ERROR)) {
+ (bp->b_ioflags & BIO_ERROR &&
+ bp->b_iocmd == BIO_READ)) {
int poffset = foff & PAGE_MASK;
int presid = resid > (PAGE_SIZE - poffset) ?
(PAGE_SIZE - poffset) : resid;
OpenPOWER on IntegriCloud