diff options
author | kib <kib@FreeBSD.org> | 2013-07-13 19:36:18 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2013-07-13 19:36:18 +0000 |
commit | cbf04bd9c1b7afe2cb170aca104d173904684d84 (patch) | |
tree | 8f64a9261696725677d4111256143bdcc90d938b /sys | |
parent | 0c582b5a5cb5eaeeb7c19b94455e8d7dcec00364 (diff) | |
download | FreeBSD-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.c | 8 |
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 |