1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

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
This commit is contained in:
Konstantin Belousov 2009-07-19 20:25:59 +00:00
parent 8e41399c8f
commit 7ac5806bfb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=195773

View File

@ -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;