svn commit: r216434 -
stable/8/cddl/contrib/opensolaris/lib/libzpool/common
Martin Matuska
mm at FreeBSD.org
Tue Dec 14 15:34:00 UTC 2010
Author: mm
Date: Tue Dec 14 15:33:59 2010
New Revision: 216434
URL: http://svn.freebsd.org/changeset/base/216434
Log:
MFC r210044, r214622:
MFC r210044 (pjd):
MFp4 180933:
Initialize rw_count properly so that zdb(8) doesn't trigger assertion in
rw_enter():
ASSERT(rwlp->rw_count == 0);
While here, assert that rw_count is 0 when destroying the lock.
MFC r214622 (pjd):
1. Remove invalid assertion.
2. Properly recalculate delta in case pthread_cond_timedwait() is interrupted.
3. Style fix.
Reported by: [1] App Deb <appdebgr at gmail.com>
Approved by: re (kib), pjd, delphij (mentor)
Modified:
stable/8/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c
Directory Properties:
stable/8/cddl/contrib/opensolaris/ (props changed)
Modified: stable/8/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c
==============================================================================
--- stable/8/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Tue Dec 14 15:33:48 2010 (r216433)
+++ stable/8/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c Tue Dec 14 15:33:59 2010 (r216434)
@@ -174,11 +174,13 @@ rw_init(krwlock_t *rwlp, char *name, int
rwlock_init(&rwlp->rw_lock, USYNC_THREAD, NULL);
rwlp->rw_owner = NULL;
rwlp->initialized = B_TRUE;
+ rwlp->rw_count = 0;
}
void
rw_destroy(krwlock_t *rwlp)
{
+ ASSERT(rwlp->rw_count == 0);
rwlock_destroy(&rwlp->rw_lock);
rwlp->rw_owner = (void *)-1UL;
rwlp->initialized = B_FALSE;
@@ -306,9 +308,9 @@ cv_timedwait(kcondvar_t *cv, kmutex_t *m
struct timeval tv;
clock_t delta;
- ASSERT(abstime > 0);
+ abstime += lbolt;
top:
- delta = abstime;
+ delta = abstime - lbolt;
if (delta <= 0)
return (-1);
@@ -319,7 +321,7 @@ top:
ts.tv_nsec = tv.tv_usec * 1000 + (delta % hz) * (NANOSEC / hz);
ASSERT(ts.tv_nsec >= 0);
- if(ts.tv_nsec >= NANOSEC) {
+ if (ts.tv_nsec >= NANOSEC) {
ts.tv_sec++;
ts.tv_nsec -= NANOSEC;
}
More information about the svn-src-stable
mailing list