svn commit: r196574 - stable/7/sys/kern

Attilio Rao attilio at
Thu Aug 27 00:45:01 UTC 2009

Author: attilio
Date: Thu Aug 27 00:45:00 2009
New Revision: 196574

  Fix a problem introduced when MFCing the rw_try_wlock() operation from
  __rw_wunlock() relies on the cookie state to not be cleanly 'tid' when
  some conditions needing of special care happens, and lock recursion is
  among those.  Dirty the cookie by adding the RW_LOCK_RECURSE flag in the
  case of a successfull try lock operation.
  This is not a problem on -CURRENT and STABLE_8 where the unlocking
  algorithm works differently.
  Submitted by:	Andrew Brampton <brampton plus freebsd at gmail dot com>


Modified: stable/7/sys/kern/kern_rwlock.c
--- stable/7/sys/kern/kern_rwlock.c	Wed Aug 26 22:51:14 2009	(r196573)
+++ stable/7/sys/kern/kern_rwlock.c	Thu Aug 27 00:45:00 2009	(r196574)
@@ -204,6 +204,7 @@ _rw_try_wlock(struct rwlock *rw, const c
 	if (rw_wlocked(rw) && (rw->lock_object.lo_flags & RW_RECURSE) != 0) {
+		atomic_set_ptr(&rw->rw_lock, RW_LOCK_RECURSED);
 		rval = 1;
 	} else
 		rval = atomic_cmpset_acq_ptr(&rw->rw_lock, RW_UNLOCKED,

More information about the svn-src-all mailing list