summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2013-07-13 19:36:18 +0000
committerkib <kib@FreeBSD.org>2013-07-13 19:36:18 +0000
commitcbf04bd9c1b7afe2cb170aca104d173904684d84 (patch)
tree8f64a9261696725677d4111256143bdcc90d938b /sys
parent0c582b5a5cb5eaeeb7c19b94455e8d7dcec00364 (diff)
downloadFreeBSD-src-cbf04bd9c1b7afe2cb170aca104d173904684d84.zip
FreeBSD-src-cbf04bd9c1b7afe2cb170aca104d173904684d84.tar.gz
Assert that runningbufspace does not underflow.
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/vfs_bio.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/vfs_bio.c b/sys/kern/vfs_bio.c
index a25c934..205e9b3 100644
--- a/sys/kern/vfs_bio.c
+++ b/sys/kern/vfs_bio.c
@@ -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
OpenPOWER on IntegriCloud