svn commit: r253327 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Sat Jul 13 19:36:19 UTC 2013


Author: kib
Date: Sat Jul 13 19:36:18 2013
New Revision: 253327
URL: http://svnweb.freebsd.org/changeset/base/253327

Log:
  Assert that runningbufspace does not underflow.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/kern/vfs_bio.c

Modified: head/sys/kern/vfs_bio.c
==============================================================================
--- head/sys/kern/vfs_bio.c	Sat Jul 13 19:34:34 2013	(r253326)
+++ head/sys/kern/vfs_bio.c	Sat Jul 13 19:36:18 2013	(r253327)
@@ -474,10 +474,12 @@ runningbufwakeup(struct buf *bp)
 {
 	long space, bspace;
 
-	if (bp->b_runningbufspace == 0)
-		return;
-	space = atomic_fetchadd_long(&runningbufspace, -bp->b_runningbufspace);
 	bspace = bp->b_runningbufspace;
+	if (bspace == 0)
+		return;
+	space = atomic_fetchadd_long(&runningbufspace, -bspace);
+	KASSERT(space >= bspace, ("runningbufspace underflow %ld %ld",
+	    space, bspace));
 	bp->b_runningbufspace = 0;
 	/*
 	 * Only acquire the lock and wakeup on the transition from exceeding


More information about the svn-src-all mailing list