svn commit: r249056 - stable/8/sys/kern

Konstantin Belousov kib at FreeBSD.org
Wed Apr 3 16:02:02 UTC 2013


Author: kib
Date: Wed Apr  3 16:02:01 2013
New Revision: 249056
URL: http://svnweb.freebsd.org/changeset/base/249056

Log:
  MFC r248563:
  Increment the write ref counter for the buffer object before calling
  bundirty().

Modified:
  stable/8/sys/kern/vfs_bio.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/kern/   (props changed)

Modified: stable/8/sys/kern/vfs_bio.c
==============================================================================
--- stable/8/sys/kern/vfs_bio.c	Wed Apr  3 15:57:18 2013	(r249055)
+++ stable/8/sys/kern/vfs_bio.c	Wed Apr  3 16:02:01 2013	(r249056)
@@ -892,7 +892,13 @@ bufwrite(struct buf *bp)
 	else
 		vp_md = 0;
 
-	/* Mark the buffer clean */
+	/*
+	 * Mark the buffer clean.  Increment the bufobj write count
+	 * before bundirty() call, to prevent other thread from seeing
+	 * empty dirty list and zero counter for writes in progress,
+	 * falsely indicating that the bufobj is clean.
+	 */
+	bufobj_wref(bp->b_bufobj);
 	bundirty(bp);
 
 	bp->b_flags &= ~B_DONE;
@@ -900,7 +906,6 @@ bufwrite(struct buf *bp)
 	bp->b_flags |= B_CACHE;
 	bp->b_iocmd = BIO_WRITE;
 
-	bufobj_wref(bp->b_bufobj);
 	vfs_busy_pages(bp, 1);
 
 	/*


More information about the svn-src-stable mailing list