Tue Dec 6 18:04:31 2011 UTC ()
Do not protect wrong KASSERT by LOCKEDBUG ifdef/endif, the latter uses
its own mecanism. Kill them both.
From discussion with pooka@.


(njoly)
diff -r1.54 -r1.55 src/sys/rump/librump/rumpkern/locks.c

cvs diff -r1.54 -r1.55 src/sys/rump/librump/rumpkern/locks.c (expand / switch to unified diff)

--- src/sys/rump/librump/rumpkern/locks.c 2011/03/21 16:41:08 1.54
+++ src/sys/rump/librump/rumpkern/locks.c 2011/12/06 18:04:31 1.55
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: locks.c,v 1.54 2011/03/21 16:41:08 pooka Exp $ */ 1/* $NetBSD: locks.c,v 1.55 2011/12/06 18:04:31 njoly Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. 4 * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
@@ -16,27 +16,27 @@ @@ -16,27 +16,27 @@
16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 16 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE. 25 * SUCH DAMAGE.
26 */ 26 */
27 27
28#include <sys/cdefs.h> 28#include <sys/cdefs.h>
29__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.54 2011/03/21 16:41:08 pooka Exp $"); 29__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.55 2011/12/06 18:04:31 njoly Exp $");
30 30
31#include <sys/param.h> 31#include <sys/param.h>
32#include <sys/kmem.h> 32#include <sys/kmem.h>
33#include <sys/mutex.h> 33#include <sys/mutex.h>
34#include <sys/rwlock.h> 34#include <sys/rwlock.h>
35 35
36#include <rump/rumpuser.h> 36#include <rump/rumpuser.h>
37 37
38#include "rump_private.h" 38#include "rump_private.h"
39 39
40/* 40/*
41 * Simple lockdebug. If it's compiled in, it's always active. 41 * Simple lockdebug. If it's compiled in, it's always active.
42 * Currently available only for mtx/rwlock. 42 * Currently available only for mtx/rwlock.
@@ -212,29 +212,26 @@ rw_exit(krwlock_t *rw) @@ -212,29 +212,26 @@ rw_exit(krwlock_t *rw)
212 212
213/* always fails */ 213/* always fails */
214int 214int
215rw_tryupgrade(krwlock_t *rw) 215rw_tryupgrade(krwlock_t *rw)
216{ 216{
217 217
218 return 0; 218 return 0;
219} 219}
220 220
221void 221void
222rw_downgrade(krwlock_t *rw) 222rw_downgrade(krwlock_t *rw)
223{ 223{
224 224
225#ifdef LOCKDEBUG 
226 KASSERT(!rw_write_held(rw)); 
227#endif 
228 /* 225 /*
229 * XXX HACK: How we can downgrade re lock in rump properly. 226 * XXX HACK: How we can downgrade re lock in rump properly.
230 */ 227 */
231 rw_exit(rw); 228 rw_exit(rw);
232 rw_enter(rw, RW_READER); 229 rw_enter(rw, RW_READER);
233 return; 230 return;
234} 231}
235 232
236int 233int
237rw_write_held(krwlock_t *rw) 234rw_write_held(krwlock_t *rw)
238{ 235{
239 236
240 return rumpuser_rw_wrheld(RUMPRW(rw)); 237 return rumpuser_rw_wrheld(RUMPRW(rw));