Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Jul 2013 19:36:18 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r253327 - head/sys/kern
Message-ID:  <201307131936.r6DJaIZa011534@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201307131936.r6DJaIZa011534>