From owner-svn-src-all@FreeBSD.ORG Thu Aug 27 00:45:01 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3D1F106568C; Thu, 27 Aug 2009 00:45:01 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9BE0A8FC20; Thu, 27 Aug 2009 00:45:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7R0j1UV079839; Thu, 27 Aug 2009 00:45:01 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7R0j1xs079837; Thu, 27 Aug 2009 00:45:01 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200908270045.n7R0j1xs079837@svn.freebsd.org> From: Attilio Rao Date: Thu, 27 Aug 2009 00:45:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196574 - stable/7/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Aug 2009 00:45:01 -0000 Author: attilio Date: Thu Aug 27 00:45:00 2009 New Revision: 196574 URL: http://svn.freebsd.org/changeset/base/196574 Log: Fix a problem introduced when MFCing the rw_try_wlock() operation from HEAD: __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 Modified: stable/7/sys/kern/kern_rwlock.c 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) { rw->rw_recurse++; + atomic_set_ptr(&rw->rw_lock, RW_LOCK_RECURSED); rval = 1; } else rval = atomic_cmpset_acq_ptr(&rw->rw_lock, RW_UNLOCKED,