zfs/module/spl
Brian Behlendorf 058de03caa Clear cv->cv_mutex when not in use
For debugging purposes the condition varaibles keep track of the
mutex used during a wait.  The idea is to validate that all callers
always use the same mutex.  Unfortunately, we have seen cases where
the caller reuses the condition variable with a different mutex but
in a way which is known to be safe.  My reading of the man pages
suggests you should not do this and always cv_destroy()/cv_init()
a new mutex.  However, there is overhead in doing this and it does
appear to be allowed under Solaris.

To accomidate this behavior cv_wait_common() and __cv_timedwait()
have been modified to clear the associated mutex when the last
waiter is dropped.  This ensures that while the condition variable
is in use the incorrect mutex case is detected.  It also allows the
condition variable to be safely recycled without requiring the
overhead of a cv_destroy()/cv_init() as long as it isn't currently
in use.

Finally, spin lock cv->cv_lock was removed because it is not required.
When the condition variable is used properly the caller will always
be holding the mutex so the spin lock is redundant.  The lock was
originally added because I expected to need to protect more than
just the cv->cv_mutex.  It turns out that was not the case.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2010-11-29 11:02:34 -08:00
..
.gitignore sun-misc-gitignore 2010-01-08 09:37:54 -08:00
Makefile.in Support custom build directories 2010-09-05 21:49:05 -07:00
spl-atomic.c Public Release Prep 2010-05-17 15:18:00 -07:00
spl-condvar.c Clear cv->cv_mutex when not in use 2010-11-29 11:02:34 -08:00
spl-cred.c Public Release Prep 2010-05-17 15:18:00 -07:00
spl-debug.c Remove deadcode caused by removal of format1 arg 2010-07-21 16:31:42 -07:00
spl-err.c Prefix all SPL debug macros with 'S' 2010-07-20 13:30:40 -07:00
spl-generic.c Display DEBUG keyword during module load when --enable-debug is used. 2010-07-20 15:31:03 -07:00
spl-kmem.c Fix 2.6.35 shrinker callback API change 2010-10-22 14:51:26 -07:00
spl-kobj.c Prefix all SPL debug macros with 'S' 2010-07-20 13:30:40 -07:00
spl-kstat.c Prefix all SPL debug macros with 'S' 2010-07-20 13:30:40 -07:00
spl-module.c Linux 2.6.36 compat, use fops->unlocked_ioctl() 2010-11-10 13:16:12 -08:00
spl-mutex.c Public Release Prep 2010-05-17 15:18:00 -07:00
spl-proc.c Prefix all SPL debug macros with 'S' 2010-07-20 13:30:40 -07:00
spl-rwlock.c Public Release Prep 2010-05-17 15:18:00 -07:00
spl-taskq.c Fix taskq code to not drop tasks when TQ_SLEEP is used. 2010-08-02 11:20:31 -07:00
spl-thread.c Prefix all SPL debug macros with 'S' 2010-07-20 13:30:40 -07:00
spl-time.c Minor 32-bit fix cast to hrtime_t before the mutliply. 2010-05-23 09:51:17 -07:00
spl-vnode.c Linux 2.6.36 compat, fs_struct->lock type change 2010-11-09 13:29:47 -08:00
spl-xdr.c Prefix all SPL debug macros with 'S' 2010-07-20 13:30:40 -07:00