svn commit: r249054 - stable/9/sys/kern

Konstantin Belousov kib at FreeBSD.org
Wed Apr 3 15:38:45 UTC 2013


Author: kib
Date: Wed Apr  3 15:38:44 2013
New Revision: 249054
URL: http://svnweb.freebsd.org/changeset/base/249054

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

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

Modified: stable/9/sys/kern/vfs_bio.c
==============================================================================
--- stable/9/sys/kern/vfs_bio.c	Wed Apr  3 15:34:25 2013	(r249053)
+++ stable/9/sys/kern/vfs_bio.c	Wed Apr  3 15:38:44 2013	(r249054)
@@ -936,7 +936,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;
@@ -944,7 +950,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-9 mailing list