Index: refcount.h =================================================================== RCS file: /usr/repo/src/sys/sys/refcount.h,v retrieving revision 1.1 diff -u -p -r1.1 refcount.h --- refcount.h 27 Sep 2005 18:01:33 -0000 1.1 +++ refcount.h 25 May 2008 22:10:26 -0000 @@ -32,6 +32,7 @@ #ifndef __SYS_REFCOUNT_H__ #define __SYS_REFCOUNT_H__ +#include #include static __inline void @@ -51,9 +52,12 @@ refcount_acquire(volatile u_int *count) static __inline int refcount_release(volatile u_int *count) { + u_int old; /* XXX: Should this have a rel membar? */ - return (atomic_fetchadd_int(count, -1) == 1); + old = atomic_fetchadd_int(count, -1); + KASSERT(old > 0, ("nagative refcount %p", count)); + return (old == 1); } #endif /* ! __SYS_REFCOUNT_H__ */