Module Name: src Committed By: yamt Date: Sat May 9 03:33:10 UTC 2009
Modified Files: src/sys/kern: kern_rwlock.c Log Message: lockdebug fixes for rw_tryupgrade/rw_downgrade. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/kern/kern_rwlock.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/kern_rwlock.c diff -u src/sys/kern/kern_rwlock.c:1.30 src/sys/kern/kern_rwlock.c:1.31 --- src/sys/kern/kern_rwlock.c:1.30 Fri Apr 24 17:53:06 2009 +++ src/sys/kern/kern_rwlock.c Sat May 9 03:33:10 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_rwlock.c,v 1.30 2009/04/24 17:53:06 ad Exp $ */ +/* $NetBSD: kern_rwlock.c,v 1.31 2009/05/09 03:33:10 yamt Exp $ */ /*- * Copyright (c) 2002, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.30 2009/04/24 17:53:06 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.31 2009/05/09 03:33:10 yamt Exp $"); #define __RWLOCK_PRIVATE @@ -660,6 +660,7 @@ } } + RW_WANTLOCK(rw, RW_READER, false); RW_LOCKED(rw, RW_READER); RW_DASSERT(rw, (rw->rw_owner & RW_WRITE_LOCKED) == 0); RW_DASSERT(rw, RW_COUNT(rw) != 0); @@ -678,7 +679,7 @@ curthread = (uintptr_t)curlwp; RW_ASSERT(rw, curthread != 0); - RW_WANTLOCK(rw, RW_WRITER, true); + RW_ASSERT(rw, rw_read_held(rw)); for (owner = rw->rw_owner;; owner = next) { RW_ASSERT(rw, (owner & RW_WRITE_LOCKED) == 0); @@ -695,6 +696,7 @@ } RW_UNLOCKED(rw, RW_READER); + RW_WANTLOCK(rw, RW_WRITER, true); RW_LOCKED(rw, RW_WRITER); RW_DASSERT(rw, rw->rw_owner & RW_WRITE_LOCKED); RW_DASSERT(rw, RW_OWNER(rw) == curthread);