svn commit: r195773 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Sun Jul 19 20:26:00 UTC 2009


Author: kib
Date: Sun Jul 19 20:25:59 2009
New Revision: 195773
URL: http://svn.freebsd.org/changeset/base/195773

Log:
  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

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c	Sun Jul 19 19:01:30 2009	(r195772)
+++ head/sys/kern/vfs_bio.c	Sun Jul 19 20:25:59 2009	(r195773)
@@ -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;


More information about the svn-src-all mailing list