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
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to